After calling pcre2_get_error_message on your pcre2_match function and checking the error code and error, as by:
char buf[255];
pcre2_get_error_message(pcre2_match(code, (PCRE2_SPTR) string, PCRE2_ZERO_TERMINATED, 0, opt_match, NULL, NULL), buf, 255);
fprintf(stderr, "%s\n", buf);
The translated error code (-51) was "NULL argument passed".
The pcre2_match docs (link at bottom) indicate that the sixth field, match_data, cannot be NULL. Maybe try allocating some memory to a pcre2_match_data* variable? It didn't work when I tried with malloc (segfault) but you might have more luck now that you know what the problem is,
Your regex works fine - the function call itself is returning an error value less than zero, which the code as written interprets as "not matching".
pcre2_match docs
https://www.pcre.org/current/doc/html/pcre2_match.html