Re: Oddly accepted RegExps

2016-06-04 Thread Isiah Meadows
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 wrote: > > > Le 3 juin 2016 à 10:20, Isiah Meadows a écrit : > > > > These three RegExps don't appear valid, even after reading the

Re: Oddly accepted RegExps

2016-06-03 Thread Claude Pache
> Le 3 juin 2016 à 10:20, Isiah Meadows 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.

Re: Oddly accepted RegExps

2016-06-03 Thread Michael Saboff
JavaScriptCore / Safari supports these three RegExp's. Like the other implementations, I don’t think the second matches anything. - Michael > On Jun 3, 2016, at 6:48 AM, Andy Earnshaw wrote: > > IE has supported all of these for as long as I can remember. AFAIK, it's > never been a requirem

Re: Oddly accepted RegExps

2016-06-03 Thread Mike Samuel
Older versions of IE did not support [^] as a way of saying any char as I discovered when writing minified passes so I'm surprised to hear that IE has consistently supported []. On Jun 3, 2016 9:48 AM, "Andy Earnshaw" wrote: > IE has supported all of these for as long as I can remember. AFAIK, i

Re: Oddly accepted RegExps

2016-06-03 Thread Andy Earnshaw
IE has supported all of these for as long as I can remember. AFAIK, it's never been a requirement _in browsers_ to escape [ inside a character class or ] outside e.g. `/[[]/` ([ is inside) or `/[]]/` (] is outside). If it's not the case in the spec (I haven't checked the spec grammar), it should

Re: Oddly accepted RegExps

2016-06-03 Thread Boris Zbarsky
On 6/3/16 4:20 AM, Isiah Meadows wrote: These three RegExps don't appear valid, even after reading the Annex B, but they do behave consistently in both Chrome and Firefox. Note that Chrome and Firefox use the same regexp implementation, so them agreeing on how a regexp is handled means a lot l

Re: Oddly accepted RegExps

2016-06-03 Thread Bergi
Jeremy Darling wrote: /[]]/ 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. I can't see it accept anything. Afaics, it's equivalent to /[]\]/ - which contai

Re: Oddly accepted RegExps

2016-06-03 Thread Jeremy Darling
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 charac

Oddly accepted RegExps

2016-06-03 Thread Isiah Meadows
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 implemen