this is an abridged reference to the POSIX API functions, these are provided
for compatibility with other libraries, rather than as an API to be used
in new code (unless you need access from a language other than C++). This
version of these functions should also happily coexist with other versions,
as the names used are macros that expand to the actual function names.

#include<boost/cregex.hpp>

or:

#include<boost/regex.h>

The following functions are available for users who need a POSIX compatible
C library, they are available in both Unicode and narrow character versions,
the standard POSIX API names are macros that expand to one version or the
other depending upon whether UNICODE is defined or not.

Important

Note that all the symbols defined here are enclosed inside namespace boost when used in C++ programs, unless
you use #include<boost/regex.h>
instead - in which case the symbols are still defined in namespace boost,
but are made available in the global namespace as well.

regerror takes the following parameters, it maps an error code to a human
readable string:

Parameter

Meaning

int code

The error code.

const regex_t* e

The regular expression (can be null).

char* buf

The buffer to fill in with the error message.

unsigned int buf_size

The length of buf.

If the error code is OR'ed with REG_ITOA then the message that results is
the printable name of the code rather than a message, for example "REG_BADPAT".
If the code is REG_ATIO then e must not be null and e->re_pend must point
to the printable name of an error code, the return value is then the value
of the error code. For any other value of code, the return value is the number
of characters in the error message, if the return value is greater than or
equal to buf_size then regerror will have to be called again with a larger
buffer.

regexec finds the first occurrence of expression e within string buf. If
len is non-zero then *m is filled in with what matched
the regular expression, m[0] contains what matched the whole string, m[1]
the first sub-expression etc, see regmatch_t in the header file declaration
for more details. The eflags parameter can be a combination of: