![]() |
![]() |
![]() |
Compile a regular expression
#include <unix.h> char *re_comp( char *s );
libc
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.
![]() |
For better portability, use regcomp(), regerror(), and regexec() instead of these functions. |
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:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
re_exec(), regcomp(), regerror(), regexec()
grep in the Utilities reference
![]() |
![]() |
![]() |