PCRE2_SET_COMPILE_RECURSION_GUARD(3)
π PCRE2_SET_COMPILE_RECURSION_GUARD(3) π
okay so this icon is from the Library Functions Manual β the header even squishes the title into PCRE2_SET_...RSION_GUARD(3), iykyk π. Itβs the PCRE2 page, and PCRE2 means Perl-compatible regular expressions (revised API). bestie, itβs giving low-level regex setup with main character energy β¨.
πΈ NAME πΈ
PCRE2 - Perl-compatible regular expressions (revised API) π¦
β¨ SYNOPSIS β¨
#include <pcre2.h>
int pcre2_set_compile_recursion_guard(pcre2_compile_context *ccontext,
int (*guard_function)(uint32_t, void *), void *user_data);
π DESCRIPTION π
okay so pcre2_set_compile_recursion_guard() defines, inside a compile context, a function that gets called whenever pcre2_compile() starts to compile a parenthesized part of a pattern. literally every time it dives into a parenthesized chunk, your little guard function gets the invite π.
The first argument to that function gives the current depth of parenthesis nesting. The second is user data that you supplied when the function was set up. The callout function should return zero if all is well, or non-zero to force an error. no cap, thatβs the whole vibe check: zero = weβre good, non-zero = nope, error time π₯.
This feature is provided so applications can check the available system stack space, in order to avoid running out. extremely useful, because stack overflow is not the cute kind of overflow π« . The result of pcre2_set_compile_recursion_guard() is always zero. periodt.
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. go read those if you want the full lore π.
bestie reminder: this page is about setting up the guard callback in a compile context, not about writing the regex itself. keep the signature exactly as shown and let the function do its thing π .
β¨ cute sign-off: PCRE2 10.47 β’ 26 November 2014 β’ PCRE2_SET_COMPILE_RECURSION_GUARD(3) β¨
π¦ 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