https://bugs.kde.org/show_bug.cgi?id=377342
Darren Lissimore <darren.lissim...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |darren.lissim...@gmail.com --- Comment #2 from Darren Lissimore <darren.lissim...@gmail.com> --- Confirmed - - disto: KDE-Neon - frameworks: 5.39.0 - kate 17.08.1 - Qt 5.9.1 Seems to be an artifact of how the whole words matching is done. kateplaintextsearch.cpp: lines 53-59 ... // abuse regex for whole word plaintext search if (m_wholeWords) { // escape dot and friends const QString workPattern = QStringLiteral("\\b%1\\b").arg(QRegExp::escape(text)); return KateRegExpSearch(m_document, m_caseSensitivity).search(workPattern, inputRange, backwards).at(0); } ... If you are searching for "$Pay" - the workPattern becomes "\\b\\$Pay\\b" Filtering down through - KateRegExpSearch::search: kateregexpsearch.cpp#193 - you find that it boils down to a KateRegExp object (light wrapper for QRegExp). Now the escaped search string does get down to the QRegExp at kateregexpsearch.cpp#435 where the underlaying QRegExp::indexIn() method is called. You can boil the search code down to this little test-app; #include <QDebug> #include <QString> #include <QRegExp> int main(void) { QString needle = "$uri"; QString haystack = "if (syswrite(OFH, $uri , $read) != $read) {"; int index; qDebug() << " Needle = " << needle << endl; qDebug() << " Haystack = " << haystack << endl; QString test = QStringLiteral("\b%1\b").arg(QRegExp::escape(needle)); QRegExp testqre; testqre.setPattern(test); qDebug() << " testqre.isValid() " << testqre.isValid() << endl; index = testqre.indexIn(haystack); qDebug() << " QRegExp - index: " << index << endl; return 0; } The results of which are: Needle = "$uri" Haystack = "if (syswrite(OFH, $uri , $read) != $read) {" testqre.isValid() true QRegExp - index: -1 Now - Qt has moved from QRegExp to QRegularExpression due to significant issues with QRegExp's engine. Unfortunately the KTextEditor search is still using QRegExp. If someone can tweak the test-app above to actually find the needle ... then a quick patch for the search system may be possible. The true long-term solution would be to migrate the search to QRegularExpression ... -- You are receiving this mail because: You are watching all bug changes.