SyntaxError: invalid decimal escape in regular expression
消息
SyntaxError: Invalid regular expression: /\00/u: Invalid decimal escape (V8-based) SyntaxError: invalid decimal escape in regular expression (Firefox) SyntaxError: Invalid regular expression: invalid octal escape for Unicode pattern (Safari)
错误类型
出了什么问题?
示例
无效情况
js
/\00/u;
/\01/u;
有效情况
js
// If you want to match NULL followed by a digit, use a character class
/[\0]0/u;
// If you want to match a character by its character value, use \x
/\x01/u;