Name

PCRE API Synopsis

Synopsis

pcre *pcre_compile(const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr)

Compile pattern with optional mode modifiers options and optional locale tables tableptr, which are created with pcre_maketables( ). Returns either a compiled regex or NULL with errptr pointing to an error message and erroffset pointing to the position in pattern where the error occurred.

int pcre_exec(const pcre *code, const pcre_extra *extra, const char *subject, int length, int startoffset, int options, int *ovector, int ovecsize)

Perform pattern matching with a compiled regular expression, code, and a supplied input string, subject, of length length. The results of a successful match are stored in ovector. The first and second elements of ovector contain the position of the first character in the overall match and the character following the end of the overall match. Each additional pair of elements, up to two thirds the length of ovector, contain the positions of the starting character and the character after capture group submatches. Optional parameters options contain mode modifiers, and pcre_extra contains the results of a call to pcre_study( ).

pcre_extra *pcre_study(const pcre *code, int options, const char **errptr)

Return information to speed up calls to pcre_exec( ) with code. There are currently no options, so options should always be zero. If an error occurred, errptr points to an error message.

int pcre_copy_named_substring(const ...

Get Regular Expression Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.