Oddly accepted RegExps

Jeremy Darling jeremy.darling at gmail.com
Fri Jun 3 12:57:31 UTC 2016


The first and the last are def vaild and I've used the first as a partial
plenty of times.

Basically [[] is the same as saying /\[/ just a little bit longer, match a
single character from the set [.
/[[]/.exec('[]') -> '['

There is nothing special about /a{,,/ its just a normal match these
characters in this order.
/a{,,/.exec('a{,,') -> 'a{,,'

/[]]/ This one throws me, that should require the first ] to be escaped
(\]) to be useful.  I can see it parse and accept but have no clue why or
what it would do.  It should throw an error.


On Fri, Jun 3, 2016 at 3:20 AM, Isiah Meadows <isiahmeadows at gmail.com>
wrote:

> 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?
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160603/9a967987/attachment.html>


More information about the es-discuss mailing list