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

Buggy backslash escaping behavior? #3717

Closed
ClementParis016 opened this issue Nov 9, 2015 · 5 comments
Closed

Buggy backslash escaping behavior? #3717

ClementParis016 opened this issue Nov 9, 2015 · 5 comments
Labels
repl Issues and PRs related to the REPL subsystem.

Comments

@ClementParis016
Copy link

Testing on both Node.js v0.12.5 and v5.0.0 on Windows, I'm encountering a strange behavior regarding backslashes. Take a look at the following I typed in the Node CLI:

> '\/'
'/'
> '\\/'
'\\/'

Here is the same thing typed in Google Chrome 46's console:

> '\/'
'/'
> '\\/'
'\/'

So, as you can see on the last lines, the escaping of backslashes doesn't seem to be correct on the Node environment. Is it something known and expected or actually a bug?

@Fishrock123
Copy link
Contributor

I think there was another issue for this, but can't seem to find it right now. :/

@mscdex mscdex added the repl Issues and PRs related to the REPL subsystem. label Nov 9, 2015
@targos
Copy link
Member

targos commented Nov 9, 2015

Here it is: #3240

@ClementParis016
Copy link
Author

Ok, thanks for your help. It's a bit confusing that every web browser behaves the same way and Node has a different behavior for this.

So, how should I proceed if I want to get a single backslash, since \\ gives me two?

@targos
Copy link
Member

targos commented Nov 9, 2015

It doesn't give you too backslashes. It's just the REPL output that's different.
You can see with console.log('\\'); that the string contains only one backslash.

@cjihrig
Copy link
Contributor

cjihrig commented Nov 9, 2015

Closing as a dup of #3240

@cjihrig cjihrig closed this as completed Nov 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

5 participants