Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
lex(1) OSS Shell and Utilities Reference Manual
x/y (slash)
Matches expression x only if expression y (trailing context) immedi-
ately follows it. For example, ab/cd matches the string ab but only if
followed by cd. Only one trailing context is permitted per pattern.
^ (circumflex)
When it appears at the beginning of the pattern, matches the beginning
of a line. For example, ˆabc matches the string abc if it is found at the
beginning of a line.
$ (dollar sign)
When it appears at the end of a pattern, matches the end of a line. It is
equivalent to /\n. For example, abc$ matches the string abc if it is
found at the end of a line.
<<EOF>>
Matches an End-of-File.
<x> (angle bracket)
Identifies a state name (see earlier description of state) and can appear
only at the beginning of a pattern. For example, <done><<EOF>>
matches an End-of-File, but only if it is in the state done.
In addition, the following rules apply for bracket expressions:
Equivalence class expressions
These represent the set of collating elements in an equivalence
class and are enclosed within bracket-equal delimiters ( [= =] ).
An equivalence class generally is designed to deal with
primary-secondary sorting; that is, for languages like French that
define groups of characters as sorting to the same primary loca-
tion, and then have a tie-breaking, secondary sort. For example,
if a, à, and â belong to the same equivalence class, then
[[=a=]b], [[=à=]b], and [[=â=]b] are each equivalent to [aàâb].
Character class expressions
These represent the set of characters in the current locale
belonging to the named ctype class. These are expressed as a
ctype class name enclosed in bracket-colon delimiters ([: :]).
In the C or OSS locale, the following character class expressions
are supported: [:alpha:], [:upper:], [:lower:], [:digit:],
[:alnum:], [:xdigit:], [:space:], [:print:], [:punct:], [:graph:],
and [:cntrl:].
Other locales may define additional character classes.
Letters and digits never have special meanings. A character such as ˆ or -, which
has a special meaning in particular contexts, refers simply to itself when found
outside that context. Spaces and tabs must be escaped to appear in a regular
expression; otherwise they indicate the end of the expression.
action Each pattern in a rule has a corresponding action, which can be any arbitrary C
statement. The pattern ends at the first nonescaped white space character; the
remainder of the line is its action. If the action is empty, then when the pattern is
matched, the input that matched it is discarded.
If the action contains a {, then the action scans till the balancing } is found, and
5−54 Hewlett-Packard Company 527188-004