RESOLVED FIXED 21414
REGRESSION: Regular Expressions and character classes, shorthands and ranges
https://bugs.webkit.org/show_bug.cgi?id=21414
Summary REGRESSION: Regular Expressions and character classes, shorthands and ranges
Bernd Lutz
Reported 2008-10-06 15:49:47 PDT
JavaScript has some difficulties with character classes and shorthands like "\w" while using a hyphen as hyphen in a range. JS example: 'hello_there'.replace(/[\w\-]+/, 'xxx') This should return the string "xxx" like in Safari 3.1.2 or Firefox 3.x. The current WebKit Build returns "xxx_there" because the character class shorthand \w seems not to include the underscore anymore. Removing the "\-" of the range fixes the bug. For some reasons you cannot simply place a underscore within a character class to fix the erratic behaviour related to the \w shorthand. The underscore must be escaped (this is normally not necessary).
Attachments
This is a test case for the bug which provides an example. (1.20 KB, text/html)
2009-01-30 09:08 PST, Gianni Chiappetta
no flags
Alexey Proskuryakov
Comment 1 2009-01-30 08:40:04 PST
Giving this full regression treatment. On IRC, it was mentioned that the issue is still present in current nightlies (I haven't tried to reproduce it).
Gianni Chiappetta
Comment 2 2009-01-30 09:08:14 PST
Created attachment 27183 [details] This is a test case for the bug which provides an example. Provides a quick example of the bug with actual results and expected results.
Gianni Chiappetta
Comment 3 2009-01-30 09:09:25 PST
I've come across this bug while testing scripts in the latest nightly. I've added a test case to illustrate the bug.
Alexey Proskuryakov
Comment 4 2009-01-30 09:20:48 PST
Confirmed with r40407.
Alexey Proskuryakov
Comment 5 2009-01-30 09:21:38 PST
Oliver Hunt
Comment 6 2009-02-02 22:09:15 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ... M JavaScriptCore/ChangeLog M JavaScriptCore/wrec/WRECGenerator.cpp M LayoutTests/ChangeLog A LayoutTests/fast/js/regexp-character-match-out-of-order-expected.txt A LayoutTests/fast/js/regexp-character-match-out-of-order.html A LayoutTests/fast/js/resources/regexp-character-match-out-of-order.js Committed r40522
Note You need to log in before you can comment on or make changes to this bug.