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