pcre2_pattern_info
Name
pcre2_pattern_info - extract information about a pattern
Synopsis
#include <pcre2.h>
int pcre2_pattern_info(const pcre2_code *code, uint32_t what,
void *where);Description
This function returns information about a compiled pattern. Its arguments are:
codePointer to a compiled regular expression pattern
whatWhat information is required
whereWhere to put the information
The recognized values for the what argument, and the information they
request are as follows:
PCRE2_INFO_ALLOPTIONSFinal options after compiling
PCRE2_INFO_ARGOPTIONSOptions passed to
pcre2_compile()PCRE2_INFO_BACKREFMAXNumber of highest backreference
PCRE2_INFO_BSRWhat
\Rmatches:PCRE2_BSR_UNICODEUnicode line endings
PCRE2_BSR_ANYCRLFCR, LF, or CRLF only
PCRE2_INFO_CAPTURECOUNTNumber of capturing subpatterns
PCRE2_INFO_DEPTHLIMITBacktracking depth limit if set, otherwise
PCRE2_ERROR_UNSETPCRE2_INFO_EXTRAOPTIONSExtra options that were passed in the compile context
PCRE2_INFO_FIRSTBITMAPBitmap of first code units, or
NULLPCRE2_INFO_FIRSTCODETYPEType of start-of-match information
- 0
nothing set
- 1
first code unit is set
- 2
start of string or after newline
PCRE2_INFO_FIRSTCODEUNITFirst code unit when type is 1
PCRE2_INFO_FRAMESIZESize of backtracking frame
PCRE2_INFO_HASBACKSLASHCReturn 1 if pattern contains
\CPCRE2_INFO_HASCRORLFReturn 1 if explicit CR or LF matches exist in the pattern
PCRE2_INFO_HEAPLIMITHeap memory limit if set, otherwise
PCRE2_ERROR_UNSETPCRE2_INFO_JCHANGEDReturn 1 if
(?J)or(?-J)was usedPCRE2_INFO_JITSIZESize of JIT compiled code, or 0
PCRE2_INFO_LASTCODETYPEType of must-be-present information
- 0
nothing set
- 1
code unit is set
PCRE2_INFO_LASTCODEUNITLast code unit when type is 1
PCRE2_INFO_MATCHEMPTY1 if the pattern can match an empty string, 0 otherwise
PCRE2_INFO_MATCHLIMITMatch limit if set, otherwise
PCRE2_ERROR_UNSETPCRE2_INFO_MAXLOOKBEHINDLength (in characters) of the longest lookbehind assertion
PCRE2_INFO_MINLENGTHLower bound length of matching strings
PCRE2_INFO_NAMECOUNTNumber of named subpatterns
PCRE2_INFO_NAMEENTRYSIZESize of name table entries
PCRE2_INFO_NAMETABLEPointer to name table
PCRE2_CONFIG_NEWLINECode for the newline sequence:
PCRE2_NEWLINE_CRPCRE2_NEWLINE_LFPCRE2_NEWLINE_CRLFPCRE2_NEWLINE_ANYPCRE2_NEWLINE_ANYCRLFPCRE2_NEWLINE_NUL
PCRE2_INFO_RECURSIONLIMITObsolete synonym for
PCRE2_INFO_DEPTHLIMITPCRE2_INFO_SIZESize of compiled pattern
If where is NULL, the function returns the amount of memory needed for
the requested information, in bytes. Otherwise, the where argument must
point to an unsigned 32-bit integer (uint32_t variable), except for the
following what values, when it must point to a variable of the type
shown:
PCRE2_INFO_FIRSTBITMAPconst uint8_t *PCRE2_INFO_JITSIZEsize_tPCRE2_INFO_NAMETABLEPCRE2_SPTRPCRE2_INFO_SIZEsize_t
The yield of the function is zero on success or:
PCRE2_ERROR_NULLthe argument
codeisNULLPCRE2_ERROR_BADMAGICthe "magic number" was not found
PCRE2_ERROR_BADOPTIONthe value of
whatis invalidPCRE2_ERROR_BADMODEthe pattern was compiled in the wrong mode
PCRE2_ERROR_UNSETthe requested information is not set
There is a complete description of the PCRE2 native API in the
pcre2api
page and a description of the POSIX API in the
pcre2posix
page.