Name

PCRE API Synopsis

pcre *pcre_compile(const char *pattern, intoptions, 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 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, intlength, intstartoffset, intoptions, int *ovector, intovecsize)

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, intoptions, const char **errptr)

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

int pcre_copy_named_substring(const pcre *

Get Regular Expression Pocket Reference, 2nd Edition 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.