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

repl cannot handle single quote in regex, when within a function #5113

Closed
phillipwei opened this issue Feb 6, 2016 · 3 comments
Closed

repl cannot handle single quote in regex, when within a function #5113

phillipwei opened this issue Feb 6, 2016 · 3 comments
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.

Comments

@phillipwei
Copy link

I'm getting a 'SyntaxError: Unexpected end of input' when I try to enter the following in the repl

var someFunction = function(s) {
    s = s.replace(/'/g, '');
}

However, s = s.replace(/'/g, '') by itself on a new line is OK. Am I doing something wrong?

@mscdex mscdex added the repl Issues and PRs related to the REPL subsystem. label Feb 6, 2016
@Trott
Copy link
Member

Trott commented Feb 6, 2016

This is indeed a bug, and you're not doing anything wrong. For a quick workaround, you can use a backslash to escape the single quote in the regular expression: s=s.replace(/\'/g, '');

But yes, you shouldn't have to do that.

@phillipwei
Copy link
Author

Thanks for the work around!

@silverwind
Copy link
Contributor

Fixed in 211018f!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants