[Previous] [Contents] [Next]

re_comp()

Compile a regular expression

Synopsis:

#include <unix.h>

char *re_comp( char *s );

Library:

libc

Description:

The re_comp() function converts a regular expression string (RE) into an internal form suitable for pattern matching. It's used with re_exec().

If re_comp() is called with a null pointer argument, the current regular expression remains unchanged.

Strings passed to both re_comp() and re_exec() must be terminated by a null byte, and may include newline characters.

The re_comp() and re_exec() functions support simple regular expressions. The regular expressions of the form \{m\}, \{m,\}, or \{m,n\} aren't supported.


Note: For better portability, use regcomp(), regerror(), and regexec() instead of these functions.

Returns:

A null pointer when the string pointed to by s is successfully converted. Otherwise, a pointer to one of the following error message strings is returned:

Classification:

Legacy Unix

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

re_exec(), regcomp(), regerror(), regexec()

grep in the Utilities reference


[Previous] [Contents] [Next]