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

Error in RegExp #610

Closed
elasmojs opened this issue Aug 8, 2020 · 2 comments · Fixed by #629
Closed

Error in RegExp #610

elasmojs opened this issue Aug 8, 2020 · 2 comments · Fixed by #629
Assignees
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Milestone

Comments

@elasmojs
Copy link
Contributor

elasmojs commented Aug 8, 2020

Hi,

The following code snippet works incorrectly for RegExp

let re = /(\w+)\s(\w+)/
let str = 'John Smith'
let newstr = str.replace(re, '$2, $1')
console.log(newstr)

Expected: Smith, John
Got: Smith, $1

thanks

@elasmojs elasmojs added the bug Something isn't working label Aug 8, 2020
@HalidOdat HalidOdat added the builtins PRs and Issues related to builtins/intrinsics label Aug 8, 2020
@HalidOdat
Copy link
Member

Hmmm. This this is probably a bug in String.prototype.replace.

@RageKnify
Copy link
Member

RageKnify commented Aug 13, 2020

I think I've found the mistake and the fix, I'll open a PR soon.

RageKnify added a commit to RageKnify/boa that referenced this issue Aug 13, 2020
Multi-line description of commit,
feel free to be detailed.
RageKnify added a commit to RageKnify/boa that referenced this issue Aug 13, 2020
@Razican Razican added this to the v0.10.0 milestone Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants