Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PosNameDescription
<1>
StringThe actual substring matching the pattern.
<2>
PosThe starting position of the match within the original string.
<3>
LengthThe length of the match.
<4>
CapturesAn @VM 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 string, use the Extract service instead.

Examples

Code Block
languagebp
// find the phone number
String  = 'Call 800-555-1212 for info'
Pattern = '((\d{3})(?:\.|-))?(\d{3})(?:\.|-)(\d{4})'
Result  = SRP_Regex("Search", String, Pattern)

// we can get the whole number, or...
PhoneNumber  = Result<1>

// we can get the parts because we captured them with parenthesis
AreaCode     = Result<4, 2>
ExchangeCode = Result<4, 3>
LineNumber   = Result<4, 4>

...