1REGEX(3) Library Functions Manual REGEX(3)
2
3
4
6 re_comp, re_exec - regular expression handler
7
9 char *re_comp(s)
10 char *s;
11
12 re_exec(s)
13 char *s;
14
16 Re_comp compiles a string into an internal form suitable for pattern
17 matching. Re_exec checks the argument string against the last string
18 passed to re_comp.
19
20 Re_comp returns 0 if the string s was compiled successfully; otherwise
21 a string containing an error message is returned. If re_comp is passed
22 0 or a null string, it returns without changing the currently compiled
23 regular expression.
24
25 Re_exec returns 1 if the string s matches the last compiled regular
26 expression, 0 if the string s failed to match the last compiled regular
27 expression, and -1 if the compiled regular expression was invalid
28 (indicating an internal error).
29
30 The strings passed to both re_comp and re_exec may have trailing or
31 embedded newline characters; they are terminated by nulls. The regular
32 expressions recognized are described in the manual entry for ed(1),
33 given the above difference.
34
36 ed(1), ex(1), egrep(1), fgrep(1), grep(1)
37
39 Re_exec returns -1 for an internal error.
40
41 Re_comp returns one of the following strings if an error occurs:
42
43 No previous regular expression,
44 Regular expression too long,
45 unmatched \(,
46 missing ],
47 too many \(\) pairs,
48 unmatched \).
49
50
51
523rd Berkeley Distribution May 15, 1985 REGEX(3)