“所有JavaScript的列表”;未捕获的语法错误:无效的正则表达式“;信息

“所有JavaScript的列表”;未捕获的语法错误:无效的正则表达式“;信息,javascript,regex,syntax-error,ecma,Javascript,Regex,Syntax Error,Ecma,是否在任何地方维护了所有可能的JavaScript正则表达式语法冲突错误消息的综合列表 try { new RegExp(pattern); } catch (e) { console.log(e.message); } 例如,一些可能的错误消息如下: Uncaught SyntaxError: Invalid regular expression: /(/: Unterminated group Uncaught SyntaxError: Invalid regular ex

是否在任何地方维护了所有可能的JavaScript正则表达式语法冲突错误消息的综合列表

try {
    new RegExp(pattern);
} catch (e) {
    console.log(e.message);
}
例如,一些可能的错误消息如下:

Uncaught SyntaxError: Invalid regular expression: /(/: Unterminated group
Uncaught SyntaxError: Invalid regular expression: /+/: Nothing to repeat
Uncaught SyntaxError: Invalid regular expression: /\/: \ at end of pattern

这取决于javascript引擎

例如,对于v8引擎浏览器,请检查

搜索此模式
ReportError(CStrVector)(
查找所有错误


对于在解析器中作为指针引用的消息也是如此。

这取决于javascript引擎

例如,对于v8引擎浏览器,请检查

搜索此模式
ReportError(CStrVector)(
查找所有错误


也适用于解析器中作为指针引用的消息。

Chrome V8引擎源代码

21条不同的错误消息,最长为40个字符


Mozilla SpiderMonkey引擎源代码


19条不同的错误消息,最长为74个字符。

Chrome V8引擎源代码

21条不同的错误消息,最长为40个字符


Mozilla SpiderMonkey引擎源代码


19条不同的错误消息,最长为74个字符。

这样的列表有什么用途?这将是特定于浏览器的。可能您必须筛选引擎的源代码。用例是了解在正则表达式验证程序模式窗口中显示的错误原因的最大长度,以便调整估计值。这确实需要upd在新的ES 2018功能之后使用ate。这样的列表有什么用途?这将是特定于浏览器的。可能您必须筛选引擎的源代码。用例是要知道在正则表达式验证器模式窗口中显示错误原因的最大长度,以便调整估计值。这确实需要在新的ES 2018功能之后进行更新s、 谢谢!这就是我最后要做的。谢谢!这就是我最后要做的。
"Regular expression too large"
"Unterminated group"
"Unmatched ')'"
"Nothing to repeat"
"Invalid group"
"Too many captures"
"\\ at end of pattern"
"Invalid property name"
"Invalid escape"
"Invalid decimal escape"
"Invalid unicode escape"
"Lone quantifier brackets"
"numbers out of order in {} quantifier"
"Incomplete quantifier"
"Invalid Unicode escape sequence"
"Invalid capture group name"
"Duplicate capture group name"
"Invalid named reference"
"Invalid named capture referenced"
"Invalid class escape"
"Invalid property name in character class"
"back reference out of range in regular expression"
"invalid range in character class"
"\\ at end of pattern"
"RegExp exec method should return object or null"
"invalid decimal escape in regular expression"
"invalid regexp group"
"invalid identity escape in regular expression"
"invalid unicode escape in regular expression"
"unterminated parenthetical"
"can't supply flags when constructing one RegExp from another"
"nothing to repeat"
"numbers out of order in {} quantifier."
"character class escape cannot be used in class range in regular expression"
"raw brace is not allowed in regular expression with unicode flag"
"raw bracket is not allowed in regular expression with unicode flag"
"too many parentheses in regular expression"
"Unicode codepoint must not be greater than 0x10FFFF in {0}"
"unmatched ) in regular expression"
"unterminated character class"