Considerations

All text to which the regular expression is applied is converted to UTF-16.

  • Performance using a regular expression may not be as fast as using a text string.
  • If the CPGID value is incorrect the conversion may fail with error message APK2080.
If the regular expression is invalid, ACIF will fail with error message APK484.

Using Default Values
If the regular expression does not match any text in the field, a default value may be used. Whether or not a default value is used, and which type of default value, depends on the type of field. There are three types of fields: fields based on group triggers, fields based on floating triggers, and transaction fields.
Group field
  1. If a regular expression does not match any text in the group field, the default value specified on the FIELD parameter is used. If no default value is specified, ACIF ends with error message APK488.
  2. If the record is only long enough to contain part of the field, the regular expression is applied only to the portion of the record that is present.
  3. If the record is not long enough to contain even the first byte of the field, the default value specified on the FIELD parameter is used. If no default value is specified, ACIF ends with error message APK449.
Floating field
  1. If a regular expression does not match any text in the floating field, there is no error and the default value specified on the FIELD parameter is not used.
  2. If the record is only long enough to contain part of the field, the regular expression is applied only to the portion of the record that is present.
  3. If the record is not long enough to contain even the first byte of the field, the default value specified on the FIELD parameter is used. If no default value is specified, ACIF ends with error message APK449.
  4. In the case of (1) the load process can use the default value in the Application. The other case where the load process uses the default value in the Application is when a floating trigger is not found within a group. Since the trigger is not found, there is no field for that group.
Transaction field (grouprange/pagerange field )
  1. If the regular expression does not match any text in the transaction field, there is no error and processing continues. A default value cannot be specified for a transaction field.
  2. If the record is not long enough to contain the entire field, there is no error and processing continues.
Examples:
Using a regular expression for a trigger:
TRIGGER1=*,1,REGEX='P[A-Z]{3} ',(TYPE=GROUP)

This regular expression will match text that begins in column 1 with the letter 'P' and is followed by three uppercase letters followed by a space, for example, "PAGE ".

Using a regular expression to extract a date in the form of July 4, 1956:
TRIGGER1=*,1,'1'
FIELD1=0,13,18,(REGEX='[A-Z][a-z]+ [0-9]+, [0-9]{4}',DEFAULT='January 1, 1970')
INDEX1='Date',FIELD1
Using a regular expression with a transaction field to extract a range of Social Security numbers:
TRIGGER1=*,1,'1'
FIELD1=0,30,3
FIELD2=*,*,12,(OFFSET=(59:70),ORDER=BYROW,REGEX='[0-9]{3}-[0-9]{2}-[0-9]{4}')
INDEX1='DEPT',FIELD1,(TYPE=GROUP)
INDEX2='SOCIAL SECURITY NUMBER',FIELD2,(TYPE=GROUPRANGE)