Extracts the first pattern match from a string.

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

Returns

The substring that matched the pattern, if found, or "" if not.

Parameters

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

Remarks

The Extract service is a simplified version of the Search service. Instead of returning a structure of information, this service simply returns the actual substring that was matched. This is useful when you are using regex to parse out information.

Examples

String   = 'Call 555-1212 for info'
Pattern  = '((\d{3})(?:\.|-))?(\d{3})(?:\.|-)(\d{4})'
PhoneNum = SRP_Regex("Extract", String, Pattern)
  • No labels