Commit | Line | Data |
---|---|---|
fb79e35a C |
1 | .TH REGEX 3 "29 February 1980" |
2 | .UC 4 | |
3 | .SH NAME | |
4 | re_comp, re_exec \- regular expression handler | |
5 | .SH SYNOPSIS | |
6 | .B char *re_comp(s) | |
7 | .br | |
8 | .B char *s; | |
9 | .PP | |
10 | .B re_exec(s) | |
11 | .br | |
12 | .B char *s; | |
13 | .SH DESCRIPTION | |
14 | .I Re_comp | |
15 | compiles a string into an internal form suitable for pattern matching. | |
16 | .I Re_exec | |
17 | checks the argument string against the last string passed to | |
18 | .I re_comp. | |
19 | .PP | |
20 | .I Re_comp | |
21 | returns 0 if the string | |
22 | .I s | |
23 | was compiled successfully; otherwise a string containing an | |
24 | error message is returned. If | |
25 | .I re_comp | |
26 | is passed 0 or a null string, it returns without changing the currently | |
27 | compiled regular expression. | |
28 | .PP | |
29 | .I Re_exec | |
30 | returns 1 if the string | |
31 | .I s | |
32 | matches the last compiled regular expression, 0 if the string | |
33 | .I s | |
34 | failed to match the last compiled regular expression, and \-1 if the compiled | |
35 | regular expression was invalid (indicating an internal error). | |
36 | .PP | |
37 | The strings passed to both | |
38 | .I re_comp | |
39 | and | |
40 | .I re_exec | |
41 | may have trailing or embedded newline characters; | |
42 | they are terminated by nulls. | |
43 | The regular expressions recognized are described in the manual entry for | |
44 | .IR ed (1), | |
45 | given the above difference. | |
46 | .SH "SEE ALSO" | |
47 | ed(1), ex(1), egrep(1), fgrep(1), grep(1) | |
48 | .SH DIAGNOSTICS | |
49 | .I Re_exec | |
50 | returns \-1 for an internal error. | |
51 | .PP | |
52 | .I Re_comp | |
53 | returns one of the following strings if an error occurs: | |
54 | .PP | |
55 | .nf | |
56 | .in +0.5i | |
57 | \fINo previous regular expression, | |
58 | Regular expression too long, | |
59 | unmatched \e(, | |
60 | missing ], | |
61 | too many \e(\e) pairs, | |
62 | unmatched \e).\fP | |
63 | .in -0.5i | |
64 | .fi |