regex(5) regex(5)
NAME
regex - regular-expression-matching types
SYNOPSIS
#include <regex.h>
DESCRIPTION
The regex.h header defines the structures and symbolic constants used
by the regcomp(), regexec(), regerror(), and regfree() functions.
The structure type regext contains at least the following member:
______________________________________________________________________
| Type | Name | Description |
|___________|_____________|___________________________________________|
| sizet | rensub | Number of parenthesized subexpressions. |
|___________|_____________|___________________________________________|
The type regofft is defined as a signed arithmetic type that can hold
the largest value that can be stored in either a type offt or type
ssizet. The structure type regmatcht contains at least the following
members:
______________________________________________________________________
| Type | Name | Description |
|____________|____________|___________________________________________|
| regofft | rmso | Byte offset from start of string to |
| | | start to substring. |
|____________|____________|___________________________________________|
| regofft | rmeo | Byte offset from start of string of the |
| | | first character after the end of sub- |
| | | string. |
|____________|____________|___________________________________________|
Values for the cflags parameters to the regcomp() function:
REGEXTENDED Use Extended Regular Expressions.
REGICASE Ignore case in match.
REGNOSUB Report only success or fail in regexec().
REGNEWLINE Change the handling of newline.
REGLITNL The nn string is treated as a newline character.
REGVIMODE << or >> are interpreted as the start or the fin-
ish of a word.
REGNSUBANCHOR The characters ^ and $ do not function as anchors
within subexpressions.
REGEMPTY regcomp() returns an error value if pattern is a
null string or empty.
Page 1 Reliant UNIX 5.44 Printed 11/98
regex(5) regex(5)
Values for the eflags parameter to the regexec() function.
REGNOTBOL The circumflex character (^), when taken as a spe-
cial character, will not match the beginning of
string.
REGNOTEOL The dollar sign ($), when taken as a special char-
acter, will not match the end of string.
The following constants are defined as error return values:
REGNOMATCH regexec() failed to match.
REGINVARG An invalid parameter was specified.
REGBADPAT Invalid regular expression.
REGECOLLATE Invalid collating element referenced.
REGECTYPE Invalid character class type referenced.
REGEESCAPE Trailing \ in pattern.
REGESUBREG Number in \digit invalid or in error.
REGEBRACK [ ] imbalance.
REGEPAREN \( \) or ( ) imbalance.
REGEBRACE \{ \} imbalance.
REGBADBR Content of \{ \} invalid: not a number, number too
large, more than two numbers, first larger than
second.
REGERANGE Invalid endpoint in range expression.
REGESPACE Out of memory.
REGBADRPT ?, * or + not preceded by valid regular expres-
sion.
REGEPATTERN A null or empty pattern was specified as a parame-
ter and regcomp() was called with the REGEMPTY
flag.
REGENOSYS The implementation does not support the function.
Page 2 Reliant UNIX 5.44 Printed 11/98
regex(5) regex(5)
The following are declared as functions and may also be declared as
macros:
int regcomp(regext *preg, const char *pattern, int cflags);
int regexec(const regext *preg, const char *string,
sizet nmatch, regmatcht pmatch[], int cflags);
sizet regerror(int errcode, const regext *preg,
char *errbuf, sizet errbufsize);
void regfree(regext *preg);
The implementation may define additional macros or constants using
names beginning with REG.
SEE ALSO
regcmp(1), regex(3), regcomp(3C), regcmp(3G), regexpr(3G), expres-
sions(5), regexp(5).
Page 3 Reliant UNIX 5.44 Printed 11/98