Greetings,

I'm finding all kinds of helpful info on VBscript regex's, but I can't find anything that shows me how to actually IMPLEMENT one in a script.

For example, I want to write a script that tests for the validity of a 10-digit phone number. I found this pattern:

\b\d\d\d-\d\d\d-\d\d\d\d
but how do I wire it up in a function that, say, returns false if the pattern is not matched by the contents of a cell??

Actually, I did find this:

Function TestPhoneNum(s As String) As Boolean
	With CreateObject("vbscript.regexp")
	    .Pattern = "\b\d\d\d-\d\d\d-\d\d\d\d"
	    .Global = True
	    TestPhoneNum = .test(s)
	End With
End Function
but the function fails with a 429 error ("ActiveX component can't create object").

Thanks!!
DM