For regular expressions containing capturing parentheses, occurrences of \1, \2, ..., in after are replaced with rx.cap(1), cap(2), ...
C++ (Qt)
QString t = "A <i>bon mot</i>.";
t.replace(QRegExp("<i>([^<]*)</i>"), "\\emph{\\1}");
// t == "A \\emph{bon mot}."