PCRE2_SET_MAX_PATTERN_COMPILED_LENGTH(3)

πŸŽ€ PCRE2_SET_MAX_PATTERN_COMPILED_LENGTH(3) πŸŽ€

Library Functions Manual girlies, this one's for you πŸ’… This page is all about setting a compiled-pattern memory limit in a compile context, and yes, it's as niche and iconic as it sounds.


✨ NAME ✨

PCRE2 - Perl-compatible regular expressions (revised API)


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <pcre2.h>

int pcre2_set_max_pattern_compiled_length(
  pcre2_compile_context *ccontext, PCRE2_SIZE value);

πŸ’– DESCRIPTION πŸ’–

Okay so picture your compile context, bestie. This function sets, inside that compile context, the maximum size β€” in bytes β€” for the memory needed to hold the compiled version of a pattern that's using this context.

The result is always zero. No cap. That's just the vibe.

If a pattern that is passed to pcre2_compile() referencing this context needs more memory than that, an error is generated. Boom. Limit exceeded, not slay.

The default is the largest number that a PCRE2_SIZE variable can hold, which is effectively unlimited. So out of the box, it's giving infinite runway ✨

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 🫢


later, bestie πŸ’– β€” this was PCRE2 10.47, dated 09 June 2024, living in the Library Functions Manual; page title PCRE2_SET_MAX_PATTERN_COMPILED_LENGTH(3). πŸŽ€βœ¨

πŸ“¦ where this page comes from