Go forward to Using Byte Offsets.
Go backward to POSIX Matching.
Go up to POSIX Regex Functions.

Reporting Errors
----------------

  If either `regcomp' or `regexec' fail, they return a nonzero error
code, the possibilities for which are defined in `regex.h'.  
See POSIX Regular Expression Compiling, and See 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
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.