|
|
1.1 root 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: .\"
5: .\" @(#)regex.3 6.2 (Berkeley) 5/19/88
6: .\"
7: .TH REGEX 3 "May 19, 1988"
8: .UC
9: .SH NAME
10: re_comp, re_exec \- regular expression handler
11: .SH SYNOPSIS
12: .B char *re_comp(s)
13: .br
14: .B char *s;
15: .PP
16: .B re_exec(s)
17: .br
18: .B char *s;
19: .SH DESCRIPTION
20: .I Re_comp
21: compiles a string into an internal form suitable for pattern matching.
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
40: failed to match the last compiled regular expression, and \-1 if the compiled
41: regular expression was invalid (indicating an internal error).
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.
49: The regular expressions recognized are described in the manual entry for
50: .IR ed (1),
51: given the above difference.
52: .SH "SEE ALSO"
53: ed(1), ex(1), egrep(1), fgrep(1), grep(1), regexp(3)
54: .SH DIAGNOSTICS
55: .I Re_exec
56: returns \-1 for an internal error.
57: .PP
58: .I Re_comp
59: returns one of the following strings if an error occurs:
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
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.