Regex101
Regex101 copied to clipboard
QRegExp Flavor
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.
Hi @brightghost didn't read the docs but to tackle just your \1
for now - the older PCRE version supports that (not PCRE2).