1regex.h(0P)                POSIX Programmer's Manual               regex.h(0P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       regex.h — regular expression matching types
13

SYNOPSIS

15       #include <regex.h>
16

DESCRIPTION

18       The <regex.h> header shall define the structures and symbolic constants
19       used by the regcomp(), regexec(), regerror(), and regfree() functions.
20
21       The  <regex.h>  header  shall  define the regex_t structure type, which
22       shall include at least the following member:
23
24
25           size_t    re_nsub    Number of parenthesized subexpressions.
26
27       The <regex.h> header shall define  the  size_t  type  as  described  in
28       <sys/types.h>.
29
30       The <regex.h> header shall define the regoff_t type as a signed integer
31       type that can hold the largest value that can be  stored  in  either  a
32       ptrdiff_t type or a ssize_t type.
33
34       The  <regex.h> header shall define the regmatch_t structure type, which
35       shall include at least the following members:
36
37
38           regoff_t    rm_so    Byte offset from start of string
39                                to start of substring.
40           regoff_t    rm_eo    Byte offset from start of string of the
41                                first character after the end of substring.
42
43       The <regex.h> header shall define the following symbolic constants  for
44       the cflags parameter to the regcomp() function:
45
46       REG_EXTENDED  Use Extended Regular Expressions.
47
48       REG_ICASE     Ignore case in match.
49
50       REG_NOSUB     Report only success or fail in regexec().
51
52       REG_NEWLINE   Change the handling of <newline>.
53
54       The  <regex.h> header shall define the following symbolic constants for
55       the eflags parameter to the regexec() function:
56
57       REG_NOTBOL    The <circumflex> character ('^'), when taken as a special
58                     character, does not match the beginning of string.
59
60       REG_NOTEOL    The  <dollar-sign> ('$'), when taken as a special charac‐
61                     ter, does not match the end of string.
62
63       The <regex.h> header shall define the following symbolic  constants  as
64       error return values:
65
66       REG_NOMATCH   regexec() failed to match.
67
68       REG_BADPAT    Invalid regular expression.
69
70       REG_ECOLLATE  Invalid collating element referenced.
71
72       REG_ECTYPE    Invalid character class type referenced.
73
74       REG_EESCAPE   Trailing <backslash> character in pattern.
75
76       REG_ESUBREG   Number in \digit invalid or in error.
77
78       REG_EBRACK    "[]" imbalance.
79
80       REG_EPAREN    "\(\)" or "()" imbalance.
81
82       REG_EBRACE    "\{\}" imbalance.
83
84       REG_BADBR     Content  of  "\{\}"  invalid:  not  a  number, number too
85                     large, more than two numbers, first larger than second.
86
87       REG_ERANGE    Invalid endpoint in range expression.
88
89       REG_ESPACE    Out of memory.
90
91       REG_BADRPT    '?', '*', or '+' not preceded by  valid  regular  expres‐
92                     sion.
93
94       The following shall be declared as functions and may also be defined as
95       macros. Function prototypes shall be provided.
96
97
98           int    regcomp(regex_t *restrict, const char *restrict, int);
99           size_t regerror(int, const regex_t *restrict, char *restrict, size_t);
100           int    regexec(const regex_t *restrict, const char *restrict, size_t,
101                      regmatch_t [restrict], int);
102           void   regfree(regex_t *);
103
104       The implementation may define  additional  macros  or  constants  using
105       names beginning with REG_.
106
107       The following sections are informative.
108

APPLICATION USAGE

110       None.
111

RATIONALE

113       None.
114

FUTURE DIRECTIONS

116       None.
117

SEE ALSO

119       <sys_types.h>
120
121       The System Interfaces volume of POSIX.1‐2017, regcomp()
122
124       Portions  of  this text are reprinted and reproduced in electronic form
125       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
126       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
127       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
128       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
129       event of any discrepancy between this version and the original IEEE and
130       The  Open Group Standard, the original IEEE and The Open Group Standard
131       is the referee document. The original Standard can be  obtained  online
132       at http://www.opengroup.org/unix/online.html .
133
134       Any  typographical  or  formatting  errors that appear in this page are
135       most likely to have been introduced during the conversion of the source
136       files  to  man page format. To report such errors, see https://www.ker
137       nel.org/doc/man-pages/reporting_bugs.html .
138
139
140
141IEEE/The Open Group                  2017                          regex.h(0P)
Impressum