PCRE2_SERIALIZE_GET_NUMBER_OF_CODES(3)

🌸 NAME 🌸

PCRE2 β€” Perl-compatible regular expressions (revised API). This is the pcre2_serialize_get_number_of_codes(3) page from the Library Functions Manual, and it’s here to help you count the codes in a serialized byte stream. Periodt. πŸ’…

✨ SYNOPSIS ✨

#include <pcre2.h>

int32_t pcre2_serialize_get_number_of_codes(const uint8_t *bytes);

πŸŽ€ DESCRIPTION πŸŽ€

Okay so bestie, here’s the tea. The bytes argument must point to a serialized byte stream that was originally created by pcre2_serialize_encode() β€” though it may have been saved on disc or elsewhere in the meantime. No cap. 🫢

The function returns the number of serialized patterns in the byte stream, or one of these negative error codes:

  • PCRE2_ERROR_BADMAGIC β€” mismatch of id bytes in bytes
  • PCRE2_ERROR_BADMODE β€” mismatch of variable unit size or PCRE version
  • PCRE2_ERROR_NULL β€” the argument is NULL
PCRE2_ERROR_BADMAGIC may mean that the data is corrupt, or that it was compiled on a system with different endianness. πŸ’€

There is a complete description of the PCRE2 native API in the pcre2api page and a description of the serialization functions in the pcre2serialize page. Go read those if you want the full lore. πŸ¦‹


xoxo, this page is brought to you by PCRE2 10.47 on 13 August 2018 β€” stay slay, bestie. πŸ’–βœ¨

πŸ“¦ where this page comes from