Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String.replace is tracking "lastIndex" on non-global regexps? #32

Closed
otac0n opened this issue Apr 19, 2011 · 2 comments
Closed

String.replace is tracking "lastIndex" on non-global regexps? #32

otac0n opened this issue Apr 19, 2011 · 2 comments
Assignees
Labels
Milestone

Comments

@otac0n
Copy link
Collaborator

otac0n commented Apr 19, 2011

This is blocking the V8 test regexp.js.

Here is the minimum repro case:

var re89 = /\s+$/;
'Oyvpxchaxg\x0a'.replace(re89, '');
'Svanamra\x0a'.replace(re89, '');

It doesn't appear that the if not search.Global and search.Put stuff is correct for String.prototype.replace.

Native.String.fs lines 213-247

@ghost ghost assigned otac0n Apr 19, 2011
@otac0n
Copy link
Collaborator Author

otac0n commented Apr 19, 2011

I'll take a look at this as soon as I can, but it may be a couple of days. The spec says "Do the search in the same manner as in String.prototype.match, including the update of searchValue.lastIndex.", but as far as I'm aware, lastIndex is only updated for global regexps.

@fholm
Copy link
Owner

fholm commented Apr 19, 2011

Fixed in 63adef9ebaa354c

@fholm fholm closed this as completed Apr 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants