1re_comp(3C)              Standard C Library Functions              re_comp(3C)
2
3
4

NAME

6       re_comp, re_exec - compile and execute regular expressions
7

SYNOPSIS

9       #include <re_comp.h>
10
11       char *re_comp(const char *string);
12
13
14       int re_exec(const char *string);
15
16

DESCRIPTION

18       The  re_comp()  function converts a regular expression string (RE) into
19       an internal form suitable for pattern matching.  The re_exec() function
20       compares  the  string  pointed  to by the string argument with the last
21       regular expression passed to re_comp().
22
23
24       If re_comp() is called with a null pointer argument, the current  regu‐
25       lar expression remains unchanged.
26
27
28       Strings  passed to both re_comp() and re_exec() must be terminated by a
29       null byte, and may include NEWLINE characters.
30
31
32       The re_comp() and re_exec() functions support  simple  regular  expres‐
33       sions,  which  are  defined  on the regexp(5) manual page. The  regular
34       expressions of the form \{m\}, \{m,\}, or \{m,n\} are not supported.
35

RETURN VALUES

37       The re_comp() function returns a null pointer when the  string  pointed
38       to  by  the  string  argument  is successfully converted.  Otherwise, a
39       pointer to one of the following error message strings is returned:
40
41         No previous regular expression
42         Regular expression too long
43         unmatched \(
44         missing ]
45         too many \(\) pairs
46         unmatched \)
47
48
49
50       Upon successful completion, re_exec() returns 1 if string  matches  the
51       last  compiled  regular  expression.  Otherwise, re_exec() returns 0 if
52       string fails to match the last compiled regular expression, and  −1  if
53       the  compiled  regular  expression  is  invalid (indicating an internal
54       error).
55

ERRORS

57       No errors are defined.
58

USAGE

60       For portability to implementations conforming to X/Open standards prior
61       to  SUS,  regcomp(3C) and regexec(3C) are preferred to these functions.
62       See standards(5).
63

SEE ALSO

65       grep(1),  regcmp(1),   regcmp(3C),   regcomp(3C),   regexec(3C),   reg‐
66       expr(3GEN), regexp(5), standards(5)
67
68
69
70SunOS 5.11                        26 Feb 1997                      re_comp(3C)
Impressum