Finds all pattern matches in a string.

Result = SRP_Regex("SearchAll", String, Pattern)

Returns

An @RM delimited list of matches, if found, or "" if no matches are found.

Parameters

ParameterDescription
StringThe target string to be pattern matched. (REQUIRED)
PatternThe regex pattern. (REQUIRED)

Remarks

The SearchAll service looks for all matches within a string. Each match is stored in a @FM delimited list, with each element having the following structure.

PosNameDescription
<x, 1>
StringThe actual substring matching the pattern.
<x, 2>
PosThe starting position of the match within the original string.
<x, 3>
LengthThe length of the match.
<x, 4>
CapturesAn @SVM delimited list of captured groups. (You can learn more about capturing groups here.)

If you don't care about all this information and just want the matched strings, use the ExtractAll service instead.

Examples

// find both phone numbers
String  = 'Call 800-555-1212 for info, or fax us at 888-555-3535'
Pattern = '((\d{3})(?:\.|-))?(\d{3})(?:\.|-)(\d{4})'
Result  = SRP_Regex("SearchAll", String, Pattern)

// the phone number info
PhoneNumber   = Result<1, 1>
PhoneAreaCode = Result<1, 4, 2>

// the fax info
FaxNumber   = Result<2, 1>
FaxAreaCode = Result<2, 4, 2>
  • No labels