regex_escape(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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