Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

Guardian Native C Library Calls (n - r) re_comp(3)
Within the bracketed string, a minus sign (-) can be used to specify a range of consecu-
tive ASCII characters. For example, [0-9] is the same as [0123456789]. If, however, the
minus sign is the rst character (following any initial "ˆ") or the last character within the
bracketed string, it loses this special meaning.
When a right square bracket is the rst character (following any initial "ˆ") within a
bracketed string, it has no special meaning and simply matches itself.
When the ",", "*", "[", or "\" characters appear within a bracketed string, they have no
special meaning and simply match themselves.
To construct more complex regular expression strings from the one-character regular expression
strings, the following rules are used:
1. A one-character regular expression string matches is a regular expression string that
matches whatever the one-character regular expression string matches.
2. A one-character regular expression string followed by an asterisk (*) is a regular expres-
sion string that matches 0 (zero) or more occurrences of the one-character regular expres-
sion string. The longest leftmost string that matches is chosen.
3. A one-character regular expression string followed by \{m\}, \{m,\},or\{m,n\} (where m
and n are non-negative integers less than 256) is a regular expression string that matches
a range of occurrences of the one-character regular expression string. \{m\} matches
exactly m occurrences; \{m,\} matches at least m occurrences; and \{m,n\} matches
between m and n occurrences, inclusive.
4. The concatenation of two or more regular expression strings matches a concatenation of
the strings matched by the individual regular expression strings.
5. A regular expression string enclosed with \( and \) is a regular expression string that
matches whatever the enclosed regular expression string matches.
6. The expression \n matches the same character string matched by an expression enclosed
within \( and \) earlier in the same regular expression string. In particular, the earlier
string is that beginning with the nth occurrence of \( counting from the left.
Finally, the circumex (ˆ) and dollar sign ($) characters can be used to limit a regular expression
string to matching the initial segment, the nal segment of the line, or both.
1. If a regular expression string has a circumex (ˆ) as its rst character, the regular expres-
sion string must match the initial segment of a line.
2. If a regular expression string has a dollar sign ($) as its last character, the regular expres-
sion string must match the nal segment of a line. The construct ˆregexp$ means that the
regular expression string regexp must match the entire line.
A null regular expression string (that is, //) is equivalent to the last regular expression string
encountered.
NOTES
This function can be called by a native process only.
The behavior of this function in locales other than POSIX is undened.
527192-005 Hewlett-Packard Company 553