Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 | both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <re_comp.h>
int re_exec(const char *string);
The re_exec() function attempts to match the string pointed to by the string argument with the last regular expression passed to re_comp().
The parameter string is a pointer to a character string to be compared.
The re_comp() and re_exec() functions are provided for historical reasons. These functions were part of the Legacy Feature in Single UNIX Specification, Version 2. They have been withdrawn and are not supported as part of Single UNIX Specification, Version 3. New applications should use the newer functions fnmatch(), glob(), regcomp() and regexec(), which provide full internationalized regular expression functionality compatible with IEEE Std 1003.1-2001.
The re_exec() function supports simple regular expressions, which are defined in re_comp() — Compile regular expression.
If successful, re_exec() returns 1 if the input string matches the last compiled regular expression.
If unsuccessful, re_exec() returns 0 if the input string fails to match the last compiled regular expression, and -1 if the compiled regular expression is invalid (indicating an internal error).