Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)

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, à (a accent grave), and â (a circumflex) belong to the same
equivalence class, then [[=a=]b], [[=à=]b], and [[=â=]b] are
each equivalent to [aàâb].
NOTE: If you are viewing this reference page online using the
man command, the special characters are not displayed. See this
reference page in the Open System Services Shell and Utilities
Reference Manual.
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.
554 Hewlett-Packard Company 527188-021