if you just want to use the captured groups in a replace, you can also use QString::replace ( const QRegExp & rx, const QString & after ). After can have '\\1', '\\2', etc items, which will be replaced with the corresponding capture groups.