Replace First

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

Fields

Regular Expression

Specify the regular expression that matches the substring to replace. Supports variable expansion. For more information, see Section 3.6, Variable Selector.

Replace With

Specify the replacement string. Supports variable expansion. For more information, see Section 3.6, Variable Selector.

Remarks

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

For details on creating regular expressions, see:

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

Example

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 Section 8.9, 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.xml.

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

Policy to reformat telephone number
Replace first
Editor

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.