Finds all pattern matches in a string.
Result = SRP_Regex("SearchAll", String, Pattern)
Returns
An @FM delimited list of matches, if found, or "" if no matches are found.
Parameters
Parameter | Description |
---|---|
String | The target string to be pattern matched. (REQUIRED) |
Pattern | The 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.
Pos | Name | Description |
---|---|---|
<x, 1> | String | The actual substring matching the pattern. |
<x, 2> | Pos | The starting position of the match within the original string. |
<x, 3> | Length | The length of the match. |
<x, 4> | Captures | An @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>