GetFirstRegexMatch

Top  Previous  Next

Sub GetFirstRegexMatch($source As String, $regex As String) As String

 

Searches in $source for the first occurrence of $regex. $regex is a Perl compatible Regular Expression.

 

GetFirstRegexMatch is case-insensitive. If $regex is not found, GetFirstRegexMatch returns an empty string.

 

Parameters

 

$source ... String expression sought.
$regex ... Regular expression being searched.

 

Example:

Dim $s, $s2

 

$s = "this is number 13 or a text"

$s2 = GetFirstRegexMatch($s, "number \d+") 'returns $s2 = "number 13"