Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
re_comp(3) Guardian Native C Library Calls Reference Manual
NAME
re_comp - Compiles regular expressions
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZSTFNSRL
G-series native OSS processes: /G/system/sysnn/zstfnsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <re_comp.h>
char *re_comp(
const char *re_string);
PARAMETERS
re_string Is a pointer to the regular expression string to be compiled by the re_comp()
function.
DESCRIPTION
The re_comp() function takes the regular expression string pointed to by the re_string parame-
ter and compiles it into an internal form that can be used for pattern matching.
If the re_comp() function is called with the re_string parameter being a null pointer, the last reg-
ular expression compiled remains the one used by the re_exec() function.
The re_comp() function supports simple regular expressions.
The following one-character regular expression strings match a single character:
1. An ordinary character (not one of the special characters discussed in paragraph 2) is a
one-character regular expression string that matches itself.
2. A backslash (\) followed by a special character is one-character regular expression string
that matches a literal appearance of that character itself. Some special characters are
always special characters while others are only special in certain circumstances.
• Characters that are special when they appear anywhere but inside square brack-
ets ([ ]) are "." (period), "*" (asterisk), "[" (left square bracket), and "\"
(backslash).
• The "ˆ" character (circumflex) is only special when it appears at the beginning of
a regular expression string or when it is the first character with a set of square
brackets.
• The "$" character (dollar sign) is only special when it appears at the very end of
a regular expression string.
• Any character used to delimit a regular expression string is special for that regu-
lar expression string.
3. A period (.) is a one-character regular expression string that matches any one single char-
acter except newline.
4. A set of square brackets containing a non-empty string of characters is a one-character
regular expression string that matches any one character found within the brackets.
When the first character of the bracketed string is a "ˆ" (caret or circumflex), the one-
character regular expression string matches any one character except the new-line and
those characters following the "ˆ" in the bracketed string.
5−52 Hewlett-Packard Company 527192-005