Reputation: 14644
A cursory look at the documentation for QRegexp
shows that it supports backreferences, while QRegularExpression
makes no mention of it. This would be notable since regular expression matching without backreferences can scale in linear time, while including backreferences scales as exponential time (source [dead link], cached version).
A similar StackOverflow answer also mentions the main differences are in the speed of execution. It would be logical to consider that the new regular expression class could employ a new algorithm, which would allow it to search in linear time, however, I have no direct knowledge of this. Are there any differences similar to the above in the new QRegularExpression
class?
Upvotes: 4
Views: 514
Reputation: 38969
QRegularExpression
departs from the functionality of QRegExp
in 5 particular areas:
\A
and \z
*?
and +?
modifiersQRegExp::CaretModes
with the exception of QRegExp::CaretAtOffset
Of these changes 4 is very relevant to this question. PCRE is by far the most advanced regular expression engine available. So it certainly supports back-references as well as many other features QRegExp
could never aspire to.
As far as the rationale behind not explicitly mentioning every functionality provided by PCRE is related to the fact that PCRE is defined by a 70k word document. If you're interested in burning through a toner cartridge, QRegularExpression
links directly to this page: http://pcre.org/pcre.txt
Incidentally quoting from that tome these are the back reference sytaxes PCRE supports:
\n
reference by number (can be ambiguous)\gn
reference by number\g{n}
reference by number\g{-n}
relative reference by number\k<name>
reference by name (Perl)\k'name'
reference by name (Perl)\g{name}
reference by name (Perl)\k{name}
reference by name (.NET)(?P=name)
reference by name (Python)
Upvotes: 4