MPE/iX Shell and Utilities Reference Manual, Vol 2
regexp(3) MPE/iX Shell and Utilities regexp(3)
NAME
regexp — syntax of regular expression patterns
DESCRIPTION
Many MPE/iX Shell and Utilities commands match strings of text in text files using a type of
pattern known as a regular expression. Simply stated, a regular expression lets you find
strings in text files not only by direct match, but also by extended matches, similar to, but
much more powerful than the file name patterns described in glob(1) and sh(1).
The newline character at the end of each input line is never explicitly matched by any regular
expression or part thereof.
expr, ex, vi, and ed take Basic regular expressions; all other MPE/iX Shell and Utilities
commands accept Extended regular expressions. grep and sed accept Basic regular expres-
sions, but will accept Extended regular expressions if the –E option is used.
Regular expressions may be made up of normal characters and/or special characters, some-
times called metacharacters. Basic and Extended regular expressions differ only in the meta-
characters they can contain.
The Basic regular expression metacharacters are:
ˆ$.*\(\)[\{\}\
The Extended regular expression metacharacters are:
|ˆ$.*+?()[{}\
These have the following meanings.
. A dot character matches any single character of the input line.
ˆ The ˆ character does not match any character but represents the beginning of the in-
put line. For example, ˆA is a regular expression matching the letter A at the begin-
ning of a line. The ˆ character is only special at the beginning of a a regular expres-
sion, or after a ( or |.
$ This does not match any character but represents the end of the input line. For ex-
ample, A$ is a regular expression matching the letter A at the end of a line. The $
character is only special at the end of a a regular expression, or before a ) or |.
[bracket-expression]
A bracket expression enclosed in square brackets is a regular expression that matches
a single character, or collating element. Note that this bracket expression applies not
only to regular expressions, but also to pattern matching as performed by the
fnmatch() function (used in file name expansion).
3-32 Miscellaneous Information