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


Searches $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 in which the search is performed.
  • $regex ... Regular expression to search for.


Example:

Dim $s, $s2

$s = "this is number 13 or a text"
$s2 = GetFirstRegexMatch($s, "number \d+") 'returns $s2 = "number 13"