PCRE_FULLINFO(3)
π PCRE_FULLINFO β bestie, come get the tea on your compiled pattern π
okay so this is the pcre_fullinfo page from the PCRE manual (that's Perl-compatible regular expressions, and yes she ate). grab a snack, we're getting all the lore about a pattern you already compiled.
β¨ SYNOPSIS β¨
first things first, pull in the header:
#include <pcre.h>
then here's the whole girlboss lineup β three of them, one for each library width, all identical in shape:
int pcre_fullinfo(const pcre *code, const pcre_extra *extra,
int what, void *where);
int pcre16_fullinfo(const pcre16 *code, const pcre16_extra *extra,
int what, void *where);
int pcre32_fullinfo(const pcre32 *code, const pcre32_extra *extra,
int what, void *where);
πΈ DESCRIPTION πΈ
so this function is literally just gossip about a compiled pattern. it tells you stuff. that's the whole job. here's who's in the group chat:
codeβ the compiled regular expression π«Άextraβ whateverpcre[16|32]_study()handed back, orNULLwhatβ which piece of info you're asking forwhereβ where the info should go
π the info menu (a.k.a. what you can ask for) π
PCRE_INFO_BACKREFMAXβ number of the highest back referencePCRE_INFO_CAPTURECOUNTβ number of capturing subpatternsPCRE_INFO_DEFAULT_TABLESβ pointer to default tablesPCRE_INFO_FIRSTBYTEβ fixed first data unit for a match, or-1for start of string or after newline, or-2otherwisePCRE_INFO_FIRSTTABLEβ table of first data units (after studying)PCRE_INFO_HASCRORLFβ returns1if explicit CR or LF matches existPCRE_INFO_JCHANGEDβ returns1if(?J)or(?-J)was usedPCRE_INFO_JITβ returns1after successful JIT compilationPCRE_INFO_JITSIZEβ size of JIT compiled codePCRE_INFO_LASTLITERALβ literal last data unit requiredPCRE_INFO_MINLENGTHβ lower bound length of matching stringsPCRE_INFO_MATCHEMPTYβ returns1if the pattern can match an empty string,0otherwisePCRE_INFO_MATCHLIMITβ match limit if set, otherwisePCRE_RROR_UNSETPCRE_INFO_MAXLOOKBEHINDβ length (in characters) of the longest lookbehind assertionPCRE_INFO_NAMECOUNTβ number of named subpatternsPCRE_INFO_NAMEENTRYSIZEβ size of name table entryPCRE_INFO_NAMETABLEβ pointer to name tablePCRE_INFO_OKPARTIALβ returns1if partial matching can be tried (always returns1after release 8.00)PCRE_INFO_OPTIONSβ option bits used for compilationPCRE_INFO_SIZEβ size of compiled patternPCRE_INFO_STUDYSIZEβ size of study dataPCRE_INFO_FIRSTCHARACTERβ fixed first data unit for a matchPCRE_INFO_FIRSTCHARACTERFLAGSβ returns1if there is a first data character set, which can then be retrieved usingPCRE_INFO_FIRSTCHARACTER;2if the first character is at the start of the data string or after a newline; and0otherwisePCRE_INFO_RECURSIONLIMITβ recursion limit if set, otherwisePCRE_ERROR_UNSETPCRE_INFO_REQUIREDCHARβ literal last data unit requiredPCRE_INFO_REQUIREDCHARFLAGSβ returns1if the last data character is set (which can then be retrieved usingPCRE_INFO_REQUIREDCHAR);0otherwise
π¦ what where has to point at π¦
bestie listen. normally your where argument has to point at an integer variable. except for these what values, which need their own special lil types:
PCRE_INFO_DEFAULT_TABLESβconst uint8_t *PCRE_INFO_FIRSTCHARACTERβuint32_tPCRE_INFO_FIRSTTABLEβconst uint8_t *PCRE_INFO_JITSIZEβsize_tPCRE_INFO_MATCHLIMITβuint32_tPCRE_INFO_NAMETABLEβPCRE_SPTR16(16-bit library)PCRE_INFO_NAMETABLEβPCRE_SPTR32(32-bit library)PCRE_INFO_NAMETABLEβconst unsigned char *(8-bit library)PCRE_INFO_OPTIONSβunsigned long intPCRE_INFO_SIZEβsize_tPCRE_INFO_STUDYSIZEβsize_tPCRE_INFO_RECURSIONLIMITβuint32_tPCRE_INFO_REQUIREDCHARβuint32_t
π the return value π
the function yields zero on success. and when it doesn't? she gives you one of these instead:
PCRE_ERROR_NULLβ the argumentcodewasNULL- or the argument
wherewasNULL
- or the argument
PCRE_ERROR_BADMAGICβ the "magic number" was not found πͺPCRE_ERROR_BADOPTIONβ the value ofwhatwas invalidPCRE_ERROR_UNSETβ the option was not set
π heads up: there's a whole complete description of the PCRE native API chilling in thepcreapipage, and a description of the POSIX API in thepcreposixpage. go read those too, no cap.
and that's the whole page, bestie, you're officially informed β¨ this was PCRE 8.36, dated 21 April 2014, and it lives under PCRE_FULLINFO(3). mwah, go slay those regexes πππ¦
π¦ where this page comes from
- alpine 3.22: pcre-doc 8.45-r4 Β· BSD-3-Clause
- alpine 3.23: pcre-doc 8.45-r4 Β· BSD-3-Clause
- alpine 3.24: pcre-doc 8.45-r4 Β· BSD-3-Clause
- arch rolling: pcre 8.45-5 Β· BSD
- centos-stream 9: pcre-devel 8.44-4.el9 Β· BSD
- centos-stream 9: pcre-devel 8.44-4.el9 Β· BSD
- debian bookworm: libpcre3-dev 2:8.39-15
- fedora 43: pcre-devel 8.45-1.fc43.9 Β· BSD-3-Clause
- fedora 43: pcre-devel 8.45-1.fc43.9 Β· BSD-3-Clause
- fedora 44: pcre-devel 8.45-1.fc43.9 Β· BSD-3-Clause
- fedora 44: pcre-devel 8.45-1.fc43.9 Β· BSD-3-Clause
- nixos 26.05: pcre 8.45
- nixos 26.05: pcre-cpp 8.45
- opensuse-leap 16.0: pcre-devel 8.45-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: pcre-devel 8.45-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: pcre-devel 8.45-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: pcre-devel 8.45-160000.2.2 Β· BSD-3-Clause
- ubuntu jammy: libpcre3-dev 2:8.39-13build5
- ubuntu jammy: libpcre3-dev 2:8.39-13ubuntu0.22.04.1
- ubuntu noble: libpcre3-dev 2:8.39-15build1
- ubuntu questing: libpcre3-dev 2:8.39-15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms