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,
    @<(i)>[^<]+</(?!i)>@
    will find a bad italic markup such as
    @<i>...</q>@
    However, the same with a backreference,
    @<(i)>[^<]+</(?!\1)>@
    does not find anything, nor of course the generalized version,
    @<(\w+)[^>]*>[^<]+</(?!\1)>@
    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.