Thanks! I wasn't able to glean that from the spec. It is admittedly confusing and not very obvious, but I was just curious.
On Fri, Jun 3, 2016, 16:41 Claude Pache <claude.pa...@gmail.com> wrote: > > > Le 3 juin 2016 à 10:20, Isiah Meadows <isiahmead...@gmail.com> a écrit : > > > > These three RegExps don't appear valid, even after reading the Annex B, > but they do behave consistently in both Chrome and Firefox. They are listed > here with equivalent regexps: > > > > - `/[[]/` -> `/\[\[\]/` > > - `/[]]/` -> `/(?!)/` (i.e. nothing) > > - `/a{,,/` -> `/a\{,,+/` > > > > Is this a spec bug or an implementation bug in the parsing? > > The first pattern is conform to the syntax and semantics given in the main > part of the spec. The most relevant rule in the grammar of > https://tc39.github.io/ecma262/#sec-regular-expressions-patterns is: > > ClassAtomNoDash :: > SourceCharacter but not one of \ or ] or - > > In particular an unescaped `[` is an acceptable atom inside a character > class. > > The last two ones are well specified by main part modified with annex b. > The second pattern starts with an empty class, which is a valid way to not > match anything. And the most relevant rule in Annex B grammar in > https://tc39.github.io/ecma262/#sec-regular-expressions-patterns is: > > ExtendedPatternCharacter:: > SourceCharacter but not one of ^ $ . * + ? ( ) [ | > > In particular, `]` and `{` may appear unescaped outside character class > (with the restriction that `{` is not at the start of a sequence that > resemble a quantifier, which case is taken care by the > `InvalidBracedQuantifier` production). > > —Claude
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss