PCRE2_GET_ERROR_MESSAGE(3)

πŸ’– NAME πŸ’–

okay so this is the PCRE2_GET_ERROR_MESSAGE(3) page from the Library Functions Manual, and bestie we are talking about PCRE2 - Perl-compatible regular expressions (revised API). iconic. periodt. ✨


✨ SYNOPSIS ✨

#include <pcre2.h>

int pcre2_get_error_message(int errorcode, PCRE2_UCHAR *buffer,
  PCRE2_SIZE bufflen);

πŸ’… DESCRIPTION πŸ’…

This function hands you a textual error message for each PCRE2 error code. no cap, that's the whole vibe. Compilation errors are positive numbers; UTF formatting errors and matching errors are negative numbers. slay, but keep track of the signs. πŸ’–

okay so the arguments are:

  • errorcode β€” an error code (positive or negative)
  • buffer β€” where to put the message
  • bufflen β€” the length of the buffer (code units)

The function returns the length of the message in code units, excluding the trailing zero, or the negative error code PCRE2_ERROR_NOMEMORY if the buffer is too small. In this case, the returned message is truncated (but still with a trailing zero). iykyk: trailing zero still shows up. πŸ’€

If errorcode does not contain a recognized error code number, the negative value PCRE2_ERROR_BADDATA is returned. so yeah, unknown code = baddata behavior, not a made-up message. πŸ™ˆ

There is 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 too, bestie, they're giving main character documentation energy. πŸ¦‹


with love and zero cap, PCRE2 10.47, dated 24 March 2017 β€” signing off πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from