archives

« Bugzilla Issues Index

#2615 — 21.2.5.7 RegExp.prototype.replace: Off by one error when processing capturing groups


21.2.5.7 RegExp.prototype.replace ( string, replaceValue ), steps 16.d.vii and 16.d.ix

Change "Let n be 0" to "Let n be 1" in step 16.d.vii and change the loop condition from "n < nCaptures" to "n <= nCaptures".

(The off by one error is in step 16.d.ix.1, it needs to be ToString(n + 1) instead of ToString(n), but starting from n=1 to n=nCaptures makes it easier to understand the algorithm.)


fixed in rev24 editor's draft


fixed in rev24