This rule checks the value of the specified field for a certain pattern. If the pattern is found, the rule returns true. Use regular expressions to define the pattern. For more information, see the Javadoc for java.util.regex. The syntax for matches is:
<matches fieldName="name" pattern="pattern"/> |
The parameters for matches are:
fieldName – The qualified field name or assigned variable for the field to check against the given pattern.
pattern – The pattern to find in the given field.
The following sample checks for phone numbers of the format (ddd)ddd-dddd (where “d” is a digit). Phone fields that are in that format are returned as good data. Fields that are not in that format are rejected and the records are written to the bad data file.
<rule> <if> <condition> <matches fieldName="Person.Phone.Phone" pattern="([0-9]{3})[0-9]{3}-[0-9]{4}"/> </condition> <then> <return fieldName="Person.Phone.Phone"/> </then> <else> <reject fieldName="Person.Phone.Phone"/> </else> </if> </rule> |