GetAllRegexMatches

Top  Previous  Next

function GetAllRegexMatches(sSource, sRegex) As String

 

Searches in sSource for all occurrences of sRegex. sRegex is a Perl compatible Regular Expression.

 

GetAllRegexMatches is case-insensitive. Each match is listed in a new line, separated with a carriage-return/line-feed. If sRegex is not found, GetAllRegexMatches returns an empty string.

 

Parameters

 

sSource ... String expression sought.
sRegex ... Regular expression being searched.

 

Example:

Dim s, s2

 

= "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




Translate document: