我想要匹配的是这个正则表达式:^[a-zA-Z]{2}[0-9]{10}$
例如如何测试E2
的内容是否存在就像 [A-Za-z][A-Za-z]##########
,我可以将其包装到 IF
中吗?声明?
最佳答案
使用这个:
Function regxMatch(Value As String, Pattern As String, Optional IgnoreCase As Boolean = False)
Dim r As New VBScript_RegExp_55.RegExp
r.Pattern = Pattern
r.IgnoreCase = IgnoreCase
If r.Test(Value) Then
M = "Matches '" & Pattern & "'"
Else
M = ""
End If
End Function
功能应该是不言自明的!
关于regex - 使用 like 与 Excel 中的字符串进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21001620/