On Mon, 8 Oct 2018, BEYER Mark via Pcre-dev wrote:
> Demo2.c is my attempt to group demo.c into functions, however, I get a return code of -51 in the execute step:
>
> > demo2 '(abc|be)' 'abcdefg'
> pattern:(abc|be)
> compile:1
> subject:abcdefg
> execute rc:-51
>
> What am I doing wrong?
>From pcre2.h:
#define PCRE2_ERROR_NULL (-51)
This means you have passed NULL to a function that doesn't expect it.
You have called pcre2_match() with either code, subject, or match_data
== NULL. (The value is also given by some of the auxiliary functions,
but I'm assuming in a simple demo you are not calling any of them.)
Note: you can get a textual error message by calling
pcre2_get_error_message().
Philip
--
Philip Hazel