Example: Using regular expression group references
When using regex (regular expression) group references, matching patterns are represented by a sequence of integer values with a dollar sign prefix. For example: $1 for the first group match, $2 for the second group match, and so forth.
To replace a portion of the incoming value contained in the In stream field column, use one of the group value tokens to represent the portion of the string that group matched.
As an example, suppose the string value of In stream field is: Homer Simpson
To switch the first and last name, you would set up the table fields as follows:
Set the use RegEx column to: Y
The value of the Search column would look similar to:
/([a-zA-Z]*) ([a-zA-Z]*)/
Each pattern inside the parenthesis represents a grouping, so that now $1 =
Homer
and $2 =Simpson
Regular expression group example To switch the first and last name, set the value of the Replace with field as:
$2 $1
This places the string
Simpson
first, followed byHomer
second.For more information about regular expressions, see https://www.regular-expressions.info/brackets.html
Last updated
Was this helpful?