PCRE2_SET_NEWLINE(3)
πΈ NAME πΈ
PCRE2 β Perl-compatible regular expressions (revised API). This page is PCRE2_SET_NEWLINE(3) from the Library Functions Manual, and it's your little guide to telling PCRE2 what counts as a newline. Periodt. π
β¨ SYNOPSIS β¨
Okay bestie, here's the exact spell:
#include <pcre2.h>
int pcre2_set_newline(pcre2_compile_context *ccontext,
uint32_t value);
π DESCRIPTION π
This function sets the newline convention within a compile context. Lowkey important: it tells PCRE2 which character(s) count as newlines when it compiles and matches patterns. It's giving βchoose your newline destiny,β and honestly? Obsessed. π
The second argument value must be one of these iconic options, no cap:
PCRE2_NEWLINE_CRβ Carriage return only πPCRE2_NEWLINE_LFβ Linefeed only β¨PCRE2_NEWLINE_CRLFβ CR followed by LF only π«PCRE2_NEWLINE_ANYCRLFβ Any of the above πPCRE2_NEWLINE_ANYβ Any Unicode newline sequence π¦PCRE2_NEWLINE_NULβ The NUL character (binary zero) π
The result is zero for success, or PCRE2_ERROR_BADDATA if the second argument is invalid. So yeah, bad value = instant vibe check fail, but at least the error code tells you what's up. π«Ά
There's 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, iykyk. π
Signed, sealed, and sent with sparkles by PCRE2 10.47, dated 19 July 2017. That's the PCRE2_SET_NEWLINE(3) page, bestie β now go set some newlines! π§π
π¦ 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