| 1 |
'\" t |
| 2 |
.\" Copyright 1995, Graeme W. Wilford <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH re_comp 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
re_comp, re_exec \- BSD regex functions |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #define _REGEX_RE_COMP |
| 16 |
.B #include <sys/types.h> |
| 17 |
.B #include <regex.h> |
| 18 |
.P |
| 19 |
.BI "[[deprecated]] char *re_comp(const char *" regex ); |
| 20 |
.BI "[[deprecated]] int re_exec(const char *" string ); |
| 21 |
.fi |
| 22 |
.SH DESCRIPTION |
| 23 |
.BR re_comp () |
| 24 |
is used to compile the null-terminated regular expression pointed to by |
| 25 |
.IR regex . |
| 26 |
The compiled pattern occupies a static area, the pattern buffer, |
| 27 |
which is overwritten by subsequent use of |
| 28 |
.BR re_comp (). |
| 29 |
If |
| 30 |
.I regex |
| 31 |
is NULL, |
| 32 |
no operation is performed and the pattern buffer's contents are not |
| 33 |
altered. |
| 34 |
.P |
| 35 |
.BR re_exec () |
| 36 |
is used to assess whether the null-terminated string pointed to by |
| 37 |
.I string |
| 38 |
matches the previously compiled |
| 39 |
.IR regex . |
| 40 |
.SH RETURN VALUE |
| 41 |
.BR re_comp () |
| 42 |
returns NULL on successful compilation of |
| 43 |
.I regex |
| 44 |
otherwise it returns a pointer to an appropriate error message. |
| 45 |
.P |
| 46 |
.BR re_exec () |
| 47 |
returns 1 for a successful match, zero for failure. |
| 48 |
.SH ATTRIBUTES |
| 49 |
For an explanation of the terms used in this section, see |
| 50 |
.BR attributes (7). |
| 51 |
.TS |
| 52 |
allbox; |
| 53 |
lbx lb lb |
| 54 |
l l l. |
| 55 |
Interface Attribute Value |
| 56 |
T{ |
| 57 |
.na |
| 58 |
.nh |
| 59 |
.BR re_comp (), |
| 60 |
.BR re_exec () |
| 61 |
T} Thread safety MT-Unsafe |
| 62 |
.TE |
| 63 |
.SH STANDARDS |
| 64 |
None. |
| 65 |
.SH HISTORY |
| 66 |
4.3BSD. |
| 67 |
.P |
| 68 |
These functions are obsolete; |
| 69 |
the functions documented in |
| 70 |
.BR regcomp (3) |
| 71 |
should be used instead. |
| 72 |
.SH SEE ALSO |
| 73 |
.BR regcomp (3), |
| 74 |
.BR regex (7), |
| 75 |
GNU regex manual |