PCRE2_SET_NEWLINE(3)

πŸ’… PCRE2_SET_NEWLINE(3)

okay so real quick before anything: this is a page from the PCRE2 library β€” that's Perl-compatible regular expressions (revised API) β€” and the manual name for it is PCRE2_SET_NEWLINE(3). Yes bestie the file is called one thing and the function inside is another, that's just how it is, we don't ask questions, we read the whole page πŸ’–


✨ SYNOPSIS ✨

like, first you gotta pull in the header, obviously:

#include <pcre2.h>

and then the actual function, and note the line break in the signature (it's two lines, not one β€” keep it cute, keep it exact):

int pcre2_set_max_varlookbehind(pcre2_compile_context *ccontext,
  uint32_t value);

slay, that's it, that's the whole call πŸŽ€


🌸 DESCRIPTION 🌸

so what does it do? it sets a maximum length β€” as in, the max number of characters that a variable-length lookbehind assertion is allowed to match. that's the whole vibe check right there πŸ”₯

the default? it's set when PCRE2 is built, and the ultimate default is 255 β€” which is literally the same as Perl, no cap πŸ‘‘

🫢 heads up bestie: lookbehind assertions without a bounding length are not supported. like, at all. so don't come for this function with unbounded energy, it will not help you 😭

and the result? always zero. every single time. iconic behaviour honestly πŸ’€βœ¨

if you want the full lore, there's a complete description of the PCRE2 native API over in the pcre2api page, and a description of the POSIX API in the pcre2posix page. go read those too, you deserve it πŸ’œ


πŸ¦‹ SEE ALSO πŸ¦‹

  • pcre2api β€” the whole native API, full description πŸ’–
  • pcre2posix β€” the POSIX API description πŸŽ€

and that's the page!! mwah πŸ’‹ this was PCRE2 10.47, dated 11 August 2023, and the page you're on is PCRE2_SET_NEWLINE(3) β€” go forth and bound your lookbehinds responsibly bestie πŸŒˆβ­πŸ‘‘

πŸ“¦ where this page comes from