archives

« Bugzilla Issues Index

#2618 — 21.2.5.7 RegExp.prototype.replace: non-global replace does not work


21.2.5.7 RegExp.prototype.replace ( string, replaceValue ).

Add a new step 16.d.xvii:

> If global is false, then let done be true.


Test case:
---
"abab".replace(/ab/, "c")
---

Expected: Returns "cab"
Actual: In step 16.d.xv, the substring starting from nextSrcPosition=2 to position=0 will be retrieved, which is invalid because nextSrcPosition > position.


fixed in rev24 editor's draft


fixed in rev24