Regex101 icon indicating copy to clipboard operation
Regex101 copied to clipboard

QRegExp Flavor

Open brightghost opened this issue 10 months ago • 1 comments

Flavor Request

Reopening https://github.com/firasdib/Regex101/issues/513 . The context I'm encountering this in is KDE's KRename utility, which is likely a common use-case for people who don't already have a deep familiarity with regex.

KRename seems to still be using the older QRegExp library. QRegExp generally follows PCRE conventions, but the differences are well-summarized in the docs.

The distinction that tripped me up is the capture group substitution, which uses the \1 syntax rather than $1. This is perhaps a bit complicated because technically QRegExp does not implement substitution strings, though it does define backreferences using the \1 format, which suggests using the same in substitution strings, which KRename, at least, follows.

The new QRegularExpression library is apparently PCRE-compatible, though it seems the situation is the same with substitution strings implicitly using \1 syntax, so that might be another issue regarding assumptions about PCRE substitution string conventions.

brightghost avatar Sep 22 '23 01:09 brightghost

Hi @brightghost didn't read the docs but to tackle just your \1 for now - the older PCRE version supports that (not PCRE2).

working-name avatar Sep 22 '23 22:09 working-name