PCRE2_PATTERN_INFO(3)
π PCRE2_PATTERN_INFO(3) π
bestie, welcome to the PCRE2 Library Functions Manual β no cap, this one is all about peeking at the info inside a compiled pattern. β¨
π NAME π
PCRE2 - Perl-compatible regular expressions (revised API)
β¨ SYNOPSIS β¨
okay so, the synopsis is literally:
#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 giving:
codeβ Pointer to a compiled regular expression patternwhatβ What information is requiredwhereβ Where to put the information
πΈ recognized what values πΈ
The recognized values for the what argument, and the information they request, are as follows:
PCRE2_INFO_ALLOPTIONSβ Final options after compilingPCRE2_INFO_ARGOPTIONSβ Options passed topcre2_compile()PCRE2_INFO_BACKREFMAXβ Number of highest backreferencePCRE2_INFO_BSRβ What\Rmatches:PCRE2_BSR_UNICODEβ Unicode line endingsPCRE2_BSR_ANYCRLFβ CR, LF, or CRLF only
PCRE2_INFO_CAPTURECOUNTβ Number of capturing subpatternsPCRE2_INFO_DEPTHLIMITβ Backtracking depth limit if set, otherwisePCRE2_ERROR_UNSETPCRE2_INFO_EXTRAOPTIONSβ Extra options that were passed in the compile contextPCRE2_INFO_FIRSTBITMAPβ Bitmap of first code units, orNULLPCRE2_INFO_FIRSTCODETYPEβ Type of start-of-match information:0β nothing set1β first code unit is set2β start of string or after newline
PCRE2_INFO_FIRSTCODEUNITβ First code unit when type is1PCRE2_INFO_FRAMESIZEβ Size of backtracking framePCRE2_INFO_HASBACKSLASHCβ Return1if pattern contains\CPCRE2_INFO_HASCRORLFβ Return1if explicit CR or LF matches exist in the patternPCRE2_INFO_HEAPLIMITβ Heap memory limit if set, otherwisePCRE2_ERROR_UNSETPCRE2_INFO_JCHANGEDβ Return1if(?J)or(?-J)was usedPCRE2_INFO_JITSIZEβ Size of JIT compiled code, or0PCRE2_INFO_LASTCODETYPEβ Type of must-be-present information:0β nothing set1β code unit is set
PCRE2_INFO_LASTCODEUNITβ Last code unit when type is1PCRE2_INFO_MATCHEMPTYβ1if the pattern can match an empty string,0otherwisePCRE2_INFO_MATCHLIMITβ Match limit if set, otherwisePCRE2_ERROR_UNSETPCRE2_INFO_MAXLOOKBEHINDβ Length (in characters) of the longest lookbehind assertionPCRE2_INFO_MINLENGTHβ Lower bound length of matching stringsPCRE2_INFO_NAMECOUNTβ Number of named subpatternsPCRE2_INFO_NAMEENTRYSIZEβ Size of name table entriesPCRE2_INFO_NAMETABLEβ Pointer to name tablePCRE2_CONFIG_NEWLINEβ Code for the newline sequence:PCRE2_NEWLINE_CRPCRE2_NEWLINE_LFPCRE2_NEWLINE_CRLFPCRE2_NEWLINE_ANYPCRE2_NEWLINE_ANYCRLFPCRE2_NEWLINE_NUL
PCRE2_INFO_RECURSIONLIMITβ Obsolete synonym forPCRE2_INFO_DEPTHLIMITPCRE2_INFO_SIZEβ Size of compiled pattern
π¦ the where pointer tea π¦
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_FIRSTBITMAPβconst uint8_t *PCRE2_INFO_JITSIZEβsize_tPCRE2_INFO_NAMETABLEβPCRE2_SPTRPCRE2_INFO_SIZEβsize_t
π return values / yield π
The yield of the function is zero on success or:
PCRE2_ERROR_NULLβ the argumentcodeisNULLPCRE2_ERROR_BADMAGICβ the "magic number" was not foundPCRE2_ERROR_BADOPTIONβ the value ofwhatis invalidPCRE2_ERROR_BADMODEβ the pattern was compiled in the wrong modePCRE2_ERROR_UNSETβ the 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.
bestie, thatβs literally the whole page π no cap.
okay bye bestie π«Ά β this manual page is from PCRE2 10.47, dated 14 February 2019. π
π¦ where this page comes from
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms