Nominate our 2022 Qt Champions!

QRegExp not supporting \n back-references in Lookaheads?

  • Per the QRegExp class ref, a search expression can refer back to captured text with a backreference, \n, and gives an example. However this appears not to be working when the backreference is within a lookahead, for example the expression,
    will find a bad italic markup such as
    However, the same with a backreference,
    does not find anything, nor of course the generalized version,
    either. Does anyone know if this a bug or a planned restriction?

  • QRegExp is indeed rather limited. I don't know if this issue you run into is a (known) limitation (can't find it in de docs with a quick scan). However, I do know that this issue will be addressed in Qt 5, as the regexp engine will be replaced by something a bit more standard, featured and performant.

Log in to reply