What I want to match is this regex: ^[a-zA-Z]{2}[0-9]{10}$
For example, how can I test whether the contents of E2 are like [A-Za-z][A-Za-z]##########, and can I wrap that into an IF statement?
Use this:
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
Function should be self explanatory!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With