This rule checks the value of the specified field against a pattern. If the patterns match, this rule replaces the existing pattern with a new pattern. Use regular expressions to define the patterns (see the Javadoc for java.util.regex for more information). The syntax for patternReplace is:
<patternReplace fieldName="name" matchPattern"old_pattern" replace="new_pattern"/> |
The parameters for patternReplace are:
fieldName – The qualified field name or assigned variable for the field to check.
matchPattern – The pattern to check for in the specified field.
replace – The pattern that will replace the existing pattern in the specified field.
The following sample searches the SSN field for 9–digit values without hyphens. If it finds such values, it inserts hyphens at the appropriate places.
<rule> <patternReplace fieldName="Person.SSN" matchPattern="[0-9]{9}" replace="[0-9]{3}-[0-9]{2}-[0-9]{4}"/> </rule> |