regex_escape(9)
π regex_escape(9) β Kernel API Manual πΈ
okay so bestie, welcome to the Kernel API Manual page for regex_escape(9) β manual name folded in near the top, no boring header copy-paste, we're cute like that π
β¨ NAME β¨
regex_escape β escapes BRE metacharacters in a string. that's it, that's the whole assignment π
π SYNOPSIS π
char * regex_escape (const char *const src , char *dst , size_t dst_size );
π ARGUMENTS π
srcβ the source string you want to escape, bestie.dstβ destination buffer for the escaped string.dst_sizeβ size of the destination buffer. yes, the buffer's size. important.
π¦ DESCRIPTION π¦
so this function escapes the characters that have special meaning in POSIX Basic Regular Expressions. the little squad is $, *, ., [, ], and ^ β those are the ones getting the escape treatment β¨
it returns a pointer to the NUL terminator in dst β cursor-style API for chaining, iykyk β or (char *)-ENOMEM if the buffer is too small. not a slay: too-small buffer gets you that -ENOMEM-cast situation, so watch dst_size, okay? π«Ά
π SEE ALSO π
- Kernel file
./tools/testing/selftests/landlock/common.h
xoxo, your favorite kernel bestie π β source/version: ./tools/testing/selftests/land... Β· date: October 2026 Β· regex_escape(9) out πΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms