If either regcomp
or regexec
fail, they return a nonzero
error code, the possibilities for which are defined in `regex.h'.
See section POSIX Regular Expression Compiling, and section POSIX Matching, for
what these codes mean. To get an error string corresponding to these
codes, you can use:
size_t regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
errcode is an error code, preg is the address of the pattern buffer which provoked the error, errbuf is the error buffer, and errbuf_size is errbuf's size.
regerror
returns the size in bytes of the error string
corresponding to errcode (including its terminating null). If
errbuf and errbuf_size are nonzero, it also returns in
errbuf the first @math{errbuf_size - 1} characters of the
error string, followed by a null.
errbuf_size must be a nonnegative number less than or equal to the
size in bytes of errbuf.
You can call regerror
with a null errbuf and a zero
errbuf_size to determine how large errbuf need be to
accommodate regerror
's error string.
Go to the first, previous, next, last section, table of contents.