Check that you wrote (?:...) correctly. There is no difference between (...) and (?:...) regexps except of performance.
And be careful with ChatGPT, it usually suggests JS-compatible regex, which is not optimal for PHP's PCRE2 library, because JS doesn't support atomic groups (?>...), some possessive quantifiers like ?*, etc. Moreover, Unicode characters are written differently (\uNNNN in JS vs \x{NNNN} in PCRE2) which can cause regex compilation errors.
And be careful with ChatGPT, it usually suggests JS-compatible regex, which is not optimal for PHP's PCRE2 library, because JS doesn't support atomic groups (?>...), some possessive quantifiers like ?*, etc. Moreover, Unicode characters are written differently (\uNNNN in JS vs \x{NNNN} in PCRE2) which can cause regex compilation errors.
Statistics: Posted by Physicist — Mon Jan 29, 2024 3:24 pm