FindRegex
Sub FindRegex($source As String, $regex As String, ByRef $startPos As Integer, ByRef $length As Integer) As Boolean
Searches $source for the first occurrence of $regex. $regex is a Regular Expression.
FindRegex is case-insensitive. The first character in $source has the position 1. If $regex is found, FindRegex returns TRUE.
Parameters
- $source ... String expression in which the search is performed.
- $regex ... Regular expression to search for.
- $startPos ... Index of the first occurrence.
- $length ... Length of the found string.
Example:
Dim $s, $iStart, $iLen
$s = "this is number 13 or a text"
If FindRegex($s, "number \d+", $iStart, $iLen) Then
' returns iStart = 9, iLen = 9
End If