Closed Bug 473572 Opened 16 years ago Closed 15 years ago

Split function in JavaScript does not produce correct result when pattern contains parentheses.

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: tarasevich.a, Unassigned)

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MRA 5.1 (build 02204); MRSPUTNIK 2, 0, 0, 36 SW) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2) Gecko/20080829082037 Shiretoko/3.1a2 Here are some JavaScript examples, that demonstrate the problem: "abc".split(/b/g) returns ["a", "c"] is OK But "abc".split(/(b)/g) returns ["a", "b", "c"] and expected is ["a", "c"] "aa".split(/a+|b+/g) returns ["",""] is OK But "aa".split(/(a|b)+/g) returns ["", "a", ""] and expected is ["", ""] Reproduced on both FF 3.0.5 and FF 3.1a2 Reproducible: Always Steps to Reproduce: Run script: <script> alert("["+"abc".split(/(b)/g).join(",")+"]"); </script> Actual Results: Alert box with [a,b,c] Expected Results: Alert box with [a,c]
Summary: Split function in JavaScript do not produce correct result when pattern contains. → Split function in JavaScript do not produce correct result when pattern contains parentheses.
Summary: Split function in JavaScript do not produce correct result when pattern contains parentheses. → Split function in JavaScript does not produce correct result when pattern contains parentheses.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.9.1 Branch
NM, this does the same thing on 3.0.
Version: 1.9.1 Branch → unspecified
See ECMA-262 Ed. 3 or 5, 15.5.4.14. /be
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.