NAGWare f77 Tools regular expression syntax

 

Index

DESCRIPTION
REGULAR EXPRESSIONS
ESCAPE CHARACTER
SETS OF CHARACTER
TAG FIELDS
WORD BREAK
SEE ALSO
 

DESCRIPTION

NAGWare f77 Tools that use regular expressions (patterns for string search and substitution) offer the user a choice of syntax. The styles currently implemented are based on: These styles are selectable by means of a tool option. Please note that only a subset of the emacs and egrep regular expression syntax is implemented.

 

REGULAR EXPRESSIONS

Regular expressions may contain any of the following metacharacters:

                           emacs   egrep  apollo  toolpack
any single character           .       .       ?         ?
beginning of line              ^       ^       %         %
end of line                    $       $       $         $
zero or more repeats           *       *       *         *
one or more repeats            +       +       +         +
zero or one repeat             ?       ?     n/a       n/a
any character in set       [...]   [...]   [...]     [...]
any character not in set  [^...]  [^...]  [~...]    [~...]
escape character               \       \       @         @
tag field, see below     \(...\) \(...\)   {...}     <...>
recall nth tag field         \n       \n      @n        &n
new line character           \n       \n      @n        @n
tab character                \t       \t      @t        @t
word break                   \b       \b     n/a         :   

 

ESCAPE CHARACTER

The escape character, see table above, is used to introduce special characters, e.g. tag field recall. It may also be used to quote special characters to be used. For example, in emacs mode \$ is the dollar sign and not the end of line character.

 

SETS OF CHARACTER

A string of characters enclosed in square brackets '[]' matches any character in the string unless the first character is a '^' in emacs and egrep mode, or a '~' in apollo and toolpack mode, when the regular expression matches any character NOT in the string (other than newline). The string of characters may be abbreviated to a character range of the form a-z, 0-9, P-Y etc.

 

TAG FIELDS

It is possible to tag up to 9 character fields in the regular expression that can be recalled in any order in the replacement text. Tag fields are opened and closed using the metacharacter listed above. Tag fields may be nested but may not overlap, the fields are numbered 1 to 9 in the order in which they are opened. Tag field 0 is the whole matched pattern. In the replacement text the tag fields are recalled using the metacharacter shown above followed by the tag field number.

In toolpack mode, regular expressions also can specify that change of case is to be made:
   &>n        Recall tagged field 'n' shifted to upper case
   &<n        Recall tagged field 'n' shifted to lower case.
There is no equivalent feature in the other regular expression styles.

 

WORD BREAK

In emacs and egrep modes '\b' and in toolpack mode a ':' matches a transition between alpha-numeric characters and non alpha-numeric characters or vice versa.

 

SEE ALSO

nag_chname, emacs(where available), egrep(1), Apollo Domain Display Manager documentation.

Copyright, Numerical Algorithms Group, Oxford, 1991-2001