[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    [Bug 100107] backward searching a regexp does not work properly
From:       Philippe Rigault <prigault () oricom ! ca>
Date:       2005-02-25 20:16:33
Message-ID: 20050225201633.12424.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=100107         




------- Additional Comments From prigault oricom ca  2005-02-25 21:16 -------
> I'm not sure why you suddenly attack qregexp. The problem is solved, it does
> work in current kate. 

Please read my comment correctly. I am _encouraging_ people to use qregexp correctly \
by avoiding the only one of its member functions (searchRev) that is problematic, and \
I have explained why.

I wish people used regexes more, and more correctly :-)

The whole problem with this bogus function is that it gives the false impression that \
it brings useful functionality, whereas in fact it dramatically contrasts with some \
fundamental properties expected by regexp users, greediness being a _very_ \
fundamental one. For example, you will never by able with this function to capture \
something as simple as the last consecutive string of digits in a string (something \
easily done with search()). How is that for a regexp member function called \
searchRev() ?

Problem solved or not for this bug, in my opinion any use of QRegExp::searchRev() is \
a time bomb, ready to cause havoc by the mere addition of quantifiers (because it \
scans forward). People start using it with a trivial regexp just because it avoids a \
loop or crafting a correct regexp, but when the regexp becomes a real one, with \
quantifiers and greediness, bugs will inevitably arise because QRegExp::searchRev() \
by its design does not work as a classical regexp engine, or as its name would \
suggest.

Fortunately, I have seen in the whole KDE only a few uses of QRegExp::searchRev(), \
all of them easily replaceable with search(), but all of them will cause problems in \
the future should the quantifiers require greediness. \
_______________________________________________ KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic