[Webkit-unassigned] [Bug 44040] New: Split with regex including an alternative | incorrectly returns splitting tokens

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 15 17:41:45 PDT 2010


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

           Summary: Split with regex including an alternative |
                    incorrectly returns splitting tokens
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.6
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: bodi.giyomu at gmail.com


Splitting a string with a regex including a choice point (such as (a|b) ) will cause the splitting tokens to be part of the resulting array.

Test case:
var string = "'test1' and 'test2' or 'test3'";
alert(string.split(/(and|or)/));

Actual result:
["'test1 ", "and", " 'test2' ", "or", " 'test3'"]

Expected result:

["'test1 ", " 'test2' ", " 'test3'"]

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



More information about the webkit-unassigned mailing list