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

regex(3) Guardian Native C Library Calls Reference Manual
NAME
regex - Executes 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 <libgen.h>
char *regex(const char *re,
const char *subject,
char *se0, ...);
extern const char *__loc1;
PARAMETERS
re Is a pointer to a compiled regular expression pattern created by the regcmp()
function.
subject Is a pointer to a string which will be searched for matches to the compiled regu-
lar expression.
se0, ... Is a list of pointers to locations where the regex() function can store subexpres-
sions.
DESCRIPTION
The regex() function executes the compiled regular expression pointed to by the re parameter
against the string pointed to by the subject parameter. That is, it searches the string for matches
to the regular expression pattern. The __loc1 global character pointer points to the rst matched
character in the string pointed to by subject. The se0, ... parameters point to locations where the
regex() function store any subexpressions needing to be returned.
The following regular expression symbols are valid:
[]*.ˆ Have the same meanings as dened in the re_comp(3) reference page.
$ Matches the end of the string. The \n character matches a newline.
- When used within brackets, signies an ASCII character range. For example,
specifying [a-d] is the same as specifying [abcd]. If the hyphen is the rst or last
character within the brackets, it represents itself. For example, [a-] matches two
characers, aand -.
+ Matches one or more consecutive occurences of the preceding regular expres-
sion. For example, [a-z]+ is the same as [a-z][a-z]*.
{m}{m,} {m,u} Matches a given number of consecutive occurrences of the preceding regular
expression. The {m,u} syntax matches from m to u occurrences where m and u
are integers indicating the maximum and minimum number of occurrences,
respectively. The {m} syntax matches exactly m occurrences while the {m,} syn-
tax matches m or more occurences.
568 Hewlett-Packard Company 527192-005