diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2015-08-17 11:28:16 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2015-08-18 14:18:48 +0000 |
commit | ee15bef3ea24a78e5fd4708c0a1cebee2e4fac5d (patch) | |
tree | cf1322ef5c14b2ae77602509fff582561dba9503 /src/widgets/kernel/qapplication.cpp | |
parent | 4738b450d26b6cdaed6f9f11f0dc22b842c124df (diff) |
QRegularExpression: fix matching over QStringRefs
Playing with the offset argument of pcre_exec is not equivalent to
adjusting the pointer to the subject string. In particular, PCRE
can go behind the offset to check for lookbehinds or "transition"
metacharacters (\b, \B, etc.).
This made the code that deals with QStringRefs not matching in behavior
with the corresponding code dealing with QStrings. For instance,
QString subject("Miss");
QRegularExpression re("(?<=M)iss");
re.match(subject.mid(1)); // doesn't match
re.match(subject.midRef(1)); // matches!!!
Instead, actually adjust the pointer to the subject string so that
the behavior is identical. A broken test that relied on the
equivalence is also removed.
Change-Id: If96333241ef59621d7f5a6a170ebd0a186844874
Reviewed-by: Volker Krause <volker.krause@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
0 files changed, 0 insertions, 0 deletions