PCRE2_SET_GLOB_SEPARATOR(3)

πŸ’… PCRE2_SET_GLOB_SEPARATOR(3) πŸ’…

okay so this is a page from the PCRE2 manual β€” yep, that's Perl-compatible regular expressions (revised API), the library functions manual bestie, we're in the grown-up section today πŸŽ€


✨ NAME ✨

PCRE2 β€” Perl-compatible regular expressions (revised API). that's the whole name section, she's short and iconic, no notes πŸ’–


🌸 SYNOPSIS 🌸

#include <pcre2.h>

int pcre2_set_glob_separator(pcre2_convert_context *cvcontext,
  uint32_t separator_char);

like, that's the whole vibe. two arguments, one int coming back at you 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bestie, listen β€” pcre2_set_glob_separator() is part of an experimental set of pattern conversion functions. yes, experimental, as in, she's still in her testing era, so don't come for her if things get weird πŸ’€

what she does: she sets the component separator character that gets used when converting globs. that's it, that's her whole job, and she does it slayfully ✨

the second argument β€” that's separator_char β€” has to be one of these three characters:

  • forward slash β€” /
  • backslash β€” \
  • dot β€” .

that's the whole guest list. nobody else gets in πŸ™ˆ

the default is lowkey platform-dependent, so keep up:

  • backslash when you're running under Windows πŸͺŸ
  • otherwise, forward slash 🐧🍎

and the result? the function gives you back zero for success β€” iconic, flawless, no cap β€” or PCRE2_ERROR_BADDATA if that second argument is invalid. so if you handed her something cursed, she's gonna tell you 🚩

fr fr, if PCRE2_ERROR_BADDATA shows up, it's not her, it's your separator. check your characters before you blame the function πŸ’…

the pattern conversion functions are described in the pcre2convert documentation β€” go read that one too, it's giving required reading πŸ“š


🧚 sign-off 🧚

and that's the page!! this one's from PCRE2 10.47, dated 17 June 2018, and it lives at the bottom as PCRE2_SET_GLOB_SEPARATOR(3) β€” go forth and separate your globs correctly, bestie, ily, bye πŸŽ€πŸ’œπŸŒˆ

πŸ“¦ where this page comes from