Commit 1593af0c authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

use {xxx} syntax for 1112121 replaces

parent c06dc8d8
......@@ -154,12 +154,16 @@ void ReplaceMatches::doReplaceNextMatch()
QString replaceText = m_replaceText;
replaceText.replace(QStringLiteral("\\\\"), QStringLiteral("¤Search&Replace¤"));
// allow captures \0 .. \9999999...
// replace from large number to small, to not replace e.g. \12 first with capture for \1, see bug 365124
for (int j = match.lastCapturedIndex(); j >= 0; --j) {
// allow captures \0 .. \9
for (int j = qMin(9, match.lastCapturedIndex()); j >= 0; --j) {
replaceText.replace(QString(QStringLiteral("\\%1")).arg(j), match.captured(j));
}
// allow captures \{0} .. \{9999999}...
for (int j = match.lastCapturedIndex(); j >= 0; --j) {
replaceText.replace(QString(QStringLiteral("\\{%1}")).arg(j), match.captured(j));
}
replaceText.replace(QStringLiteral("\\n"), QStringLiteral("\n"));
replaceText.replace(QStringLiteral("\\t"), QStringLiteral("\t"));
replaceText.replace(QStringLiteral("¤Search&Replace¤"), QStringLiteral("\\"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment