[#5423] Fix preg_match to work with older PCRE versions

- Use `?P<...>`, not `?<...>`
Merge pull request #5438 in master
Merge pull request #5423
Merge pull request #5423 in develop