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

Don’t replace \x08 with \b in regular expressions #10

Open
mathiasbynens opened this issue Aug 1, 2013 · 1 comment
Open

Don’t replace \x08 with \b in regular expressions #10

mathiasbynens opened this issue Aug 1, 2013 · 1 comment

Comments

@mathiasbynens
Copy link
Owner

In regular expressions, \b has a different meaning than in strings (where it’s equivalent to '\x08'`):

/\b/.test('\b'); // false
/\x08/.test('\b'); // true

But jsesc incorrectly replaces \x08 in regular expressions with \b:

jsesc(/\x08/); // '/\\b/'

Only these single character escapes have the same meaning in regular expressions as in strings:

\f \n \r \t \v \0

Also see #11: \B, \w, \W, \s, \S, \d, \D, \cM, etc. should be preserved.

mathiasbynens added a commit that referenced this issue Aug 3, 2013
It may return at some point in the future.

Ref. #10 and #11.
@mathiasbynens
Copy link
Owner Author

Relevant: mishoo/UglifyJS#54 (comment)

mathiasbynens added a commit that referenced this issue May 25, 2014
It may return at some point in the future.

Ref. #10 and #11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant