/\033/ → SyntaxError: invalid regexp escape
jirutka opened this issue · comments
/\033/.test("\033")
SyntaxError: invalid regexp escape (line 1)
[...]
\033
is a valid escape character; it’s an octal representation of the ESC character from ASCII, 1B in hex. And it works in Node.js, browsers and even other langs (e.g. Ruby).
Equivalent to \033
is /\x1B/
that works in lowjs.
See DukTape issue:
As far as I recall these are part of the Annex B optional regexp syntax features https://www.ecma-international.org/ecma-262/6.0/#sec-regular-expressions-patterns. Duktape only supports some parts of the Annex B syntax at present.
I think that is OK, have not noticed any lib/module actually using the other syntax..?