chakra-core/ChakraCore

[RegExp] Exceptions for RegExp in Annex B of the ES2017 spec shouldn't be applied when the "unicode" flag is present

Open

#518 建立於 2016年3月10日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)JavaScript (9,000 star) (1,374 fork)batch import
BugSeverity: 2help wanted

描述

Annex B.1.4 contains exceptions that allow web browsers to diverge from the normal RegExp grammar. These exceptions aren't allowed when the "unicode" flag is present, but our current implementation doesn't take this into account.

There are many exceptions, but a few examples would be:

  • PatternCharacter: {
  • CharacterClassEscape: [\d-a]
  • DecimalEscape: \3 when the number of capturing parentheses is less than 3
  • IdentityEscape: \h, \u
  • QuantifiableAssertion Quantifier: (?!.)+

The above should throw a SyntaxError when used as, e.g.,/{/u

貢獻者指南

[RegExp] Exceptions for RegExp in Annex B of the ES2017 spec shouldn't be applied when the "unicode" flag is present · chakra-core/ChakraCore#518 | Good First Issue