Hints and Tips Using Regular Expressions

A regular expression is a pattern which is used to match characters in a string. There are many excellent online resources which explain the syntax rules of regular expressions. Here are examples of some of the most common:

Account
Look for the characters Account. By default, searches are case sensitive.
[A-Z]
Look for one uppercase letter.
[A-Z] {3}
Look for three consecutive uppercase letters.
[0-9] {5}
Look for five consecutive digits.
[0-9]+
Look for one or more digits.
[^a-z]
Look for everything except lower case a to z.
\s
Look for one whitespace character (space, tab, etc).
\S
Look for any character not whitespace.

ACIF can use a regular expression in the TRIGGER and FIELD parameter. In the TRIGGER, the regular expression specifies the pattern for which to search; in the FIELD, the regular expression is applied to the characters which have been extracted from the field in a way similar to using a mask.

The regular expression must be specified in the code page given by the CPGID parameter. If you are running on an ASCII platform and the CPGID of the document is ASCII then the regular expression can be specified as text, for example:

CPGID=819
TRIGGER1=*,*,'PAGE',(TYPE=GROUP)
TRIGGER2=*,25,REGEX='[A-Z]{3}-[A-Z]{6}',(TYPE=FLOAT)
FIELD1=0,9,2,(TRIGGER=1,BASE=TRIGGER)
FIELD2=0,38,10,(TRIGGER=2,BASE=0,REGEX='[A-Z] [0-9]{3}-\S+')
INDEX1='Page',FIELD1,(TYPE=GROUP,BREAK=YES)
INDEX2='Sub-Source',FIELD2
In this example TRIGGER2 uses a regular expression, which specifies a pattern of three uppercase letters, followed by a hyphen,