PCRE2_JIT_COMPILE(3)
π PCRE2_JIT_COMPILE(3) π
Okay so this is the PCRE2 page for Perl-compatible regular expressions (revised API), and honestly bestie, it's giving βmake my regex go zoomβ energy. π
β¨ NAME β¨
PCRE2 β Perl-compatible regular expressions (revised API). That's the manual name, and this page is PCRE2_JIT_COMPILE(3). Slay. π
πΈ SYNOPSIS πΈ
#include <pcre2.h>
int pcre2_jit_compile(pcre2_code *code, uint32_t options);
π¦ DESCRIPTION π¦
So this function requests JIT compilation. If the just-in-time compiler is available, it further processes a compiled pattern into machine code that executes much faster than the pcre2_match() interpretive matching function. Full details are given in the pcre2jit documentation. No cap, that's the whole vibe. π₯
The availability of JIT support can be tested by calling pcre2_compile_jit() with a single option PCRE2_JIT_TEST_ALLOC (the code argument is ignored, so a NULL value is accepted). Such a call returns zero if JIT is available and has a working allocator. Otherwise it returns PCRE2_ERROR_NOMEMORY if JIT is available but cannot allocate executable memory, or PCRE2_ERROR_JIT_UNSUPPORTED if JIT support is not compiled. That's the vibe check. π«Ά
Otherwise, the first argument must be a pointer that was returned by a successful call to pcre2_compile(), and the second must contain one or more of the following bits:
PCRE2_JIT_COMPLETEβ compile code for full matchingPCRE2_JIT_PARTIAL_SOFTβ compile code for soft partial matchingPCRE2_JIT_PARTIAL_HARDβ compile code for hard partial matching
There is also an obsolete option called PCRE2_JIT_INVALID_UTF, which has been superseded by the pcre2_compile() option PCRE2_MATCH_INVALID_UTF.
The old option is deprecated and may be removed in the future. π
The yield of the function when called with any of the three options above is 0 for success, or a negative error code otherwise. In particular, PCRE2_ERROR_JIT_BADOPTION is returned if JIT is not supported or if an unknown bit is set in options. The function can also return PCRE2_ERROR_NOMEMORY if JIT is unable to allocate executable memory for the compiler, even if it was because of a system security restriction. In a few cases, the function may return with PCRE2_ERROR_JIT_UNSUPPORTED for unsupported features. So yeah, read those error codes, bestie. ππ
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.
Signed off with main-character energy by PCRE2 10.47, dated 22 August 2024 β this was PCRE2_JIT_COMPILE(3), and yes, she ate. πβ¨π
π¦ 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