1regex.h(3HEAD) Headers regex.h(3HEAD)
2
3
4
6 regex.h, regex - regular expression matching types
7
9 #include <regex.h>
10
11
13 The <regex.h> header defines the structures and symbolic constants used
14 by the regcomp(), regexec(), regerror(), and regfree() functions. See
15 regcomp(3C).
16
17
18 The structure type regex_t contains the following member:
19
20 size_t re_nsub number of parenthesized subexpressions
21
22
23
24 The type size_t is defined as described in <sys/types.h>. See
25 types.h(3HEAD).
26
27
28 The type regoff_t is defined as a signed integer type that can hold the
29 largest value that can be stored in either a type off_t or type
30 ssize_t. The structure type regmatch_t contains the following members:
31
32 regoff_t rm_so byte offset from start of string to start
33 of substring
34 regoff_t rm_eo byte offset from start of string of the
35 first character after the end of substring
36
37
38
39 Values for the cflags parameter to the regcomp function are as follows:
40
41 REG_EXTENDED use extended regular expressions
42
43
44 REG_ICASE ignore case in match
45
46
47 REG_NOSUB report only success or fail in regexec()
48
49
50 REG_NEWLINE change the handling of NEWLINE character
51
52
53
54 Values for the eflags parameter to the regexec() function are as fol‐
55 lows:
56
57 REG_NOTBOL The circumflex character (^), when taken as a special
58 character, does not match the beginning of string.
59
60
61 REG_NOTEOL The dollar sign ($), when taken as a special character,
62 does not match the end of string.
63
64
65
66 The following constants are defined as error return values:
67
68 REG_NOMATCH regexec() failed to match.
69
70
71 REG_BADPAT Invalid regular expression.
72
73
74 REG_ECOLLATE Invalid collating element referenced.
75
76
77 REG_ECTYPE Invalid character class type referenced.
78
79
80 REG_EESCAPE Trailing '\' in pattern.
81
82
83 REG_ESUBREG Number in \fIdigit invalid or in error.
84
85
86 REG_EBRACK "[]" imbalance.
87
88
89 REG_EPAREN "\(\)" or "()" imbalance.
90
91
92 REG_EBRACE "" imbalance.
93
94
95 REG_BADBR Content of "" invalid: not a number, number too large,
96 more than two numbers, first larger than second.
97
98
99 REG_ERANGE Invalid endpoint in range expression.
100
101
102 REG_ESPACE Out of memory.
103
104
105 REG_BADRPT '?', '*', or '+' not preceded by valid regular expres‐
106 sion.
107
108
109 REG_ENOSYS Reserved.
110
111
113 See attributes(5) for descriptions of the following attributes:
114
115
116
117
118 ┌─────────────────────────────┬─────────────────────────────┐
119 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
120 ├─────────────────────────────┼─────────────────────────────┤
121 │Interface Stability │Standard │
122 └─────────────────────────────┴─────────────────────────────┘
123
125 regcomp(3C), types.h(3HEAD), attributes(5), standards(5)
126
127
128
129SunOS 5.11 9 Sep 2004 regex.h(3HEAD)