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).
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).
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.
I've come across this bug while testing scripts in the latest nightly. I've added a test case to illustrate the bug.
Confirmed with r40407.
<rdar://problem/6543487>
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