fix handling of \\ in replacement string in s/// cmd of built-in sed

QString::replace() has no way of escaping capture group references,
so simply disarm double backslashes. of course this is broken, but
we'd need to reimplement it from scratch to fix it properly. "corner
case" ...

Change-Id: I357fbfd22c9c4a68809e5af6efad1de3a95706b5
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-11-20 15:50:43 +01:00 committed by The Qt Project
parent d4c548ce5c
commit 3d89b10db9

View File

@ -133,6 +133,7 @@ static int doSed(int argc, char **argv)
SedSubst subst;
subst.from = QRegExp(phases.at(0));
subst.to = phases.at(1);
subst.to.replace("\\\\", "\\"); // QString::replace(rx, sub) groks \1, but not \\.
substs << subst;
}
} else if (argv[i][0] == '-' && argv[i][1] != 0) {