Open mathiasbynens opened 11 years ago
In regular expressions, \b has a different meaning than in strings (where it’s equivalent to '\x08'`):
\b
/\b/.test('\b'); // false /\x08/.test('\b'); // true
But jsesc incorrectly replaces \x08 in regular expressions with \b:
\x08
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.
\B
\w
\W
\s
\S
\d
\D
\cM
Relevant: https://github.com/mishoo/UglifyJS2/issues/54#issuecomment-32833742
In regular expressions,
\b
has a different meaning than in strings (where it’s equivalent to '\x08'`):But jsesc incorrectly replaces
\x08
in regular expressions with\b
:Only these single character escapes have the same meaning in regular expressions as in strings:
Also see #11:
\B
,\w
,\W
,\s
,\S
,\d
,\D
,\cM
, etc. should be preserved.