[Webkit-unassigned] [Bug 23121] New: RegExp fails for non-greedy quatifier following negative char sets w/ single char

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 5 11:51:10 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=23121

           Summary: RegExp fails for non-greedy quatifier following negative
                    char sets w/ single char
           Product: WebKit
           Version: 525.x (Safari 3.2)
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: webkit.prestaul at spamgourmet.com


RegExp fails to properly match strings when the pattern includes a non-greedy
quantifier for a negative character class that only contains one character. 
For example:

'FAILURE'.replace(/^[^Z]*?$/g, 'SUCCESS');  // output: "FAILURE"
'FAILURE'.replace(/^[^Z]+?$/g, 'SUCCESS');  // output: "FAILURE"


The greedy quantifier works:

'FAILURE'.replace(/^[^Z]*$/g, 'SUCCESS');  // output: "SUCCESS"


More that one character works:

'FAILURE'.replace(/^[^ZQ]*?$/g, 'SUCCESS');  // output: "SUCCESS"


Shorthand character classes work:

'FAILURE'.replace(/^[^\s]*?$/g, 'SUCCESS');  // output: "SUCCESS"
'FAILURE'.replace(/^[^\W]*?$/g, 'SUCCESS');  // output: "SUCCESS"


Positive character classes work:

'FAILURE'.replace(/^[FAILURE]*?$/g, 'SUCCESS');  // output: "SUCCESS"
'FAILURE'.replace(/^[\w]*?$/g, 'SUCCESS');  // output: "SUCCESS"


I've seen the bug on both Max and PC.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list