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:
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??\b\d\d\d-\d\d\d-\d\d\d\d
Actually, I did find this:
but the function fails with a 429 error ("ActiveX component can't create object").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
Thanks!!
DM
Office 2001 Mac version
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks