Function zhengze(Rng As Range)
Set regx = CreateObject("vbscript.regexp")
With regx
.Global = True
.Pattern = "d{4}-d{2}-d{2}" '写正则表达式
Set mat = .Execute(Rng)'存储匹配到的集合
For Each mg In mat'循环读取存储了匹配结果的列表
If .test(Rng) Then
zhengze = mg'匹配到值,则返回值到单元格
Else
zhengze = 0
'Set mat = .Execute(value)
'cells 单元格 读取单元格内容,将内容写入单元格,将变量rg的值输入到c列的n行
End If
Next
End With
End Function