PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capture groups (including unknown groups when PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set) to be treated as empty strings when inserted as described above. If this option is not set, an attempt to insert an unset group causes the PCRE2_ERROR_UNSET error. This option does not influence the extended substitution syntax described below.
string replaceprints an error when I try to substitute a back reference to an optional capture group that was not matched.
Steps to reproduce
string replaceto behave similar to perl because the docs mention "Perl-compatible" regular expressions.
The text was updated successfully, but these errors were encountered: