- expand_string_message = string_sprintf("regular expression error in "
- "\"%s\": %s at offset %d", sub[1], rerror, roffset);
- return NULL;
+ const pcre2_code * re;
+ PCRE2_SIZE offset;
+ int err;
+
+ if (!(re = pcre2_compile((PCRE2_SPTR)sub[1], PCRE2_ZERO_TERMINATED,
+ PCRE_COPT, &err, &offset, pcre_cmp_ctx)))
+ {
+ uschar errbuf[128];
+ pcre2_get_error_message(err, errbuf, sizeof(errbuf));
+ expand_string_message = string_sprintf("regular expression error in "
+ "\"%s\": %s at offset %ld", sub[1], errbuf, (long)offset);
+ return NULL;
+ }
+
+ tempcond = regex_match_and_setup(re, sub[0], 0, -1);
+ break;