Export (0) Print
Expand All
Expand Minimize

2.1.47 [ECMA-262/5] Section 15.10.1, Patterns

V0083:

The specification states:

Term ::
  Assertion
  Atom
  Atom Quantifier
Atom ::
  PatternCharacter
  .
  \ AtomEscape
  CharacterClass
  ( Disjunction )
  ( ? : Disjunction )
PatternCharacter ::
  SourceCharacter but not one of
    ^ $ \ . * + ? ( ) [ ] { } |
Assertion ::
  ^
  $
  \ b
  \ B
  ( ? = Disjunction )
  ( ? ! Disjunction )
AtomEscape ::
  DecimalEscape
  CharacterEscape
  CharacterClassEscape
CharacterEscape ::
  ControlEscape
  c ControlLetter
  HexEscapeSequence
  UnicodeEscapeSequence
  IdentityEscape
IdentityEscape ::
  SourceCharacter but not IdentifierPart
  <ZWJ>
  <ZWNJ>
NonemptyClassRanges ::
  ClassAtom
  ClassAtom NonemptyClassRangesNoDash
  ClassAtom - ClassAtom ClassRanges
NonemptyClassRangesNoDash ::
  ClassAtom
  ClassAtomNoDash NonemptyClassRangesNoDash
  ClassAtomNoDash - ClassAtom ClassRanges
ClassAtom ::
  -
  ClassAtomNoDash
ClassAtomNoDash ::
  SourceCharacter but not one of \ or ] or -
  \ ClassEscape
ClassEscape ::
  DecimalEscape
  b
  CharacterEscape
  CharacterClassEscape

IE9 Mode, IE10 Mode, and IE11 Mode (All Versions)

The pattern grammar is instead context sensitive for the productions listed below, and ambiguities are introduced that are broken by ordering and contextual information. The following grammar is used, with each alternative considered only if previous production alternatives do not match:

Term ::
  Assertion
  AtomNoBrace Quantifier
  Atom
  QuantifiableAssertion Quantifier
AtomNoBrace ::
  PatternCharacterNoBrace
  .
  \ AtomEscape
  CharacterClass
  ( Disjunction )
  ( ? : Disjunction )
Atom ::
  PatternCharacter
  .
  \ AtomEscape
  CharacterClass
  ( Disjunction )
  ( ? : Disjunction )
PatternCharacterNoBrace ::
  SourceCharacter but not one of
    ^ $ \ . * + ? ( ) [ ] { } |
PatternCharacter ::
  SourceCharacter but not one of
    ^ $ \ . * + ? ( ) [ ] |
QuantifiableAssertion ::
  ( ? = Disjunction ) 
  ( ? ! Disjunction )
Assertion ::
  ^
  $
  \ b 
  \ B 
  QuantifiableAssertion
AtomEscape ::
  DecimalEscape but only if the integer value of DecimalEscape is <= NCapturingParens
  CharacterClassEscape
  CharacterEscape
CharacterEscape ::
  ControlEscape
  c ControlLetter
  HexEscapeSequence
  UnicodeEscapeSequence
  OctalEscapeSequence
  IdentityEscape
IdentityEscape ::
  SourceCharacter but not c
  <ZWJ>
  <ZWNJ>
NonemptyClassRanges ::
  ClassAtom
  ClassAtom NonemptyClassRangesNoDash
  ClassAtomInRange - ClassAtomInRange ClassRanges
NonemptyClassRangesNoDash ::
  ClassAtom
  ClassAtomNoDash NonemptyClassRangesNoDash
  ClassAtomNoDashInRange - ClassAtomInRange ClassRanges
ClassAtom ::
  -
  ClassAtomNoDash
ClassAtomNoDash ::
  SourceCharacter but not one of \ or ] or -
  \ ClassEscape
ClassAtomInRange ::
  -
  ClassAtomNoDashInRange
ClassAtomNoDashInRange ::
  SourceCharacter but not one of \ or ] or -
  \ ClassEscape but only if ClassEscape evaluates to a CharSet with exactly one character
  \ IdentityEscape
ClassEscape ::
  DecimalEscape but only if the integer value of DecimalEscape is <= NCapturingParens
  b
  CharacterClassEscape
  CharacterEscape
Show:
© 2014 Microsoft