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


Searches $source for all occurrences of $regex. $regex is a Regular Expression.


GetAllRegexMatches is case-insensitive. Each match is listed on a new line, separated by a carriage return/line feed. If $regex is not found, GetAllRegexMatches 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 number 12 or number 1003 or a date"
$s2 = GetAllRegexMatches($s, "number \d+")
'returns $s2 = "number 12"#13#10"number 1003"


The extracted lines can be sorted with the function SortStringLines.