Replace First

Replaces the first occurrence of a regular expression in the enclosed tokens.


Regular Expression

Specify the regular expression that matches the substring to replace.

Replace With

Specify the replacement string.


The matching instance is replaced by the string specified in the Replace with field.

For details on creating regular expressions, see:

The pattern option CASE_INSENSITIVE, DOTALL, and UNICODE_CASE are used but can be reversed using the appropriate embedded escapes.


The example reformats the telephone number (nnn)-nnn-nnnn to nnn-nnn-nnnn. The rule is from the predefined rules that come with Identity Manager. For more information, see Input or Output Transformation - Reformat Telephone Number from (nnn) nnn-nnnn to nnn-nnn-nnnn. To view the policy in XML, see predef_transformation_reformat_telephone1.

The Replace First token is used in the Reformat Operation Attribute action.

Policy to reformat telephone number
Replace first

The regular expression of ^\((\d\d\d)\)\s*(\d\d\d)-(\d\d\d\d)$ represents (nnn) nnn-nnnn and the regular expression of $1-$2-$3 represents nnn. This rule transforms the format of the telephone number from (nnn) nnn-nnnn to nnn-nnn-nnnn.