3 .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 .if !
\a\\$4
\a\a .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
7 .ie
\a\\$3
\a\a .ft \\$1
11 .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
16 .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
19 .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
22 .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
24 .de EX \" start example
41 recomp, reexec, ressub, refree, reerror \(mi regular expression library
46 Re_program_t* recomp(char* \fIpattern\fP, int \fIflags\fP);
47 int reexec(Re_program_t* \fIre\fP, char* \fIsource\fP);
48 void ressub(Re_program_t* \fIre\fP, Sfio_t* \fIsp\fP, char* \fIold\fP, char* \fInew\fP, int \fIflags\fP);
49 void reerror(char* \fImessage\fP);
50 void refree(Re_program_t* \fIre\fP);
54 compiles a regular expression in
56 and returns a pointer to the compiled regular expression.
57 The space is allocated by
59 and may be released by
61 Regular expressions are as in
63 except that newlines are treated as ordinary
66 matches the end of a null-terminated string.
72 style special characters,
90 matches the null-terminated
92 string against the compiled regular expression
94 from a previous call to
98 returns a non-zero value.
105 is filled with character pointers to the substrings of
107 that correspond to the
108 parenthesized subexpressions of
111 points to the beginning and
120 matched left parenthesis, counting from 1.)
123 pick out the substring that corresponds to
124 the entire regular expression.
127 are filled with zeros.
133 are extended as far as possible.
134 A maximum of 9 subexpressions will be matched.
135 The structure of elements of
152 a substitution instance of
158 in the context of the last
166 is a digit, is replaced by the
168 .LI re\->match[ n ].sp
170 .LI re\->match[ n ].ep .
173 is replaced by the string delimited by
176 .IR re\->match[0].ep .
181 then all occurrences of
192 is converted to lower [upper] case.
195 called whenever an error is detected in
202 on the standard error file and exits.
204 may be replaced to perform
205 special error processing.
208 returns 0 for an invalid expression or other failure.
212 is accepted, 0 otherwise.
214 ed(1), grep(1), expr(1)