Top  Previous  Next

function FindRegex(sSource, sRegex, ByRef iStartPos, ByRef iLength) As Boolean


Searches in sSource for the first occurrence of sRegex. sRegex is a Perl compatible Regular Expression.


FindRegex is case-insensitive. The first character in sSource has the position 1. If sRegex is found, FindRegex returns TRUE.




sSource ... String expression sought.
sRegex ... Regular expression being searched.
iStartPos ... Index of first occurrence.
iLength ... Length of found String.



Dim s, iStart, iLen


= "this is number 13 or a text"

If FindRegex(s, "number \d+", iStart, iLen) Then

   ' returns iStart = 9, iLen = 9

End If

Translate document: