Hello,
I found the following Instr function with RegEx.
The code Always stuck at 'set found = regEx.Execute(SearchIn).
Can anyone help me what's wrong with it?
Note that I've also checked the Microsoft VBScript Regular Expressions (1.0 or 5.5) and still is giving the same error.
Public Function InStrRegEx(ByVal searchIn As String, ByVal searchFor As String) As Long
Dim regEx As Object, found As Object
If Len(searchIn) > 0 And Len(searchFor) > 0 Then
Set regEx = CreateObject("VBScript.RegExp")
regEx.Pattern = searchFor
regEx.Global = True
regEx.IgnoreCase = True
Set found = regEx.Execute(searchIn) <-----when debug, this is where it's shown
If found.Count <> 0 Then InStrRegEx = found(0).FirstIndex + 1
End If
End Function
NOTE: Was able to resolve by using "\\([0-9]+) ([0-9]+)\\" instead of "\## ####\"
Bookmarks