re_comp(3) — Subroutines
NAME
re_comp, re_exec − Handle regular expressions
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <regex.h>
char ∗re_comp(
char ∗string);
int re_exec(
char ∗string);
PARAMETERS
stringPoints to the string that is to be matched or converted.
DESCRIPTION
The re_comp() function converts a string into an internal form suitable for pattern matching. The re_exec() function compares the string parameter with the last string passed to the re_comp() function.
When the re_comp() function is passed a value of 0 (zero) or NULL, the regular expression currently being converted remains unchanged.
Strings passed to both the re_comp() and re_exec() functions may have trailing or embedded newline characters; however, these strings are terminated by a zero byte. Recognized regular expressions are described in the grep(1) reference page.
RETURN VALUES
The re_comp() function returns a value of 0 (zero) when the string pointed to by the string parameter is successfully converted; otherwise, an error message string is returned.
Upon successful completion, the re_exec() function returns a value of 1 if string matches the last compiled regular expression. Otherwise, the re_exec() function returns a value of 0 (zero), if string fails to match the last compiled regular expression, and a value of -1, if the compiled regular expression is invalid (indicating an internal error).
NOTES
These interfaces are obsolete; they do not support multibyte characters and should be avoided. Use the POSIX regcomp() interface in place of re_comp() and re_exec().
RELATED INFORMATION
Functions: regcomp(3).
Commands: grep(1).