Specifications
Matching Expressions
Equalizer Installation and Administration Guide 169
Within a bracket expression, the name of a character class enclosed in '[:' and ':]' stands for the list
of all characters belonging to that class.
There are two special cases of bracket expressions: the bracket expressions '[[:<:]]' and '[[:>:]]'
match the null string at the beginning and end of a word respectively. A word is defined as a
sequence of word characters that is neither preceded nor followed by word characters. A word
character is an alnum character (as defined by ctype(3)) or an underscore. This is an extension,
compatible with but not specified by IEEE Std 1003.2 (''POSIX.2''), and should be used with
caution in software intended to be portable to other systems.
Matching Expressions
If a real expression could match more than one substring of a given string, the real expression
matches the one starting earliest in the string. If the real expression could match more than one
substring starting at that point, it matches the longest. Subexpressions also match the longest
possible substrings, subject to the constraint that the whole match be as long as possible, with
subexpressions starting earlier in the real expression taking priority over ones starting later. Note
that higher-level subexpressions thus take priority over their lower-level component subexpressions.
Match lengths are measured in characters, not collating elements. A null string is considered longer
than no match at all. For example, 'bb*' matches the three middle characters of 'abbbc',
'(wee|week)(knights|nights)' matches all ten characters of 'weeknights', when '(.*).*' is matched
against 'abc' the parenthesized subexpression matches all three characters, and when '(a*)*' is
matched against 'bc' both the whole real expression and the parenthesized subexpression match the
null string.