Thinking more about it: there is a fatal incompatibility:

```js
/^\u{12345}$/u.test("\u{12345}") // true
/^\u{12345}$/.test("u".repeat(12345)) // true (annex b)
```
and

```js
/^\u{1F4A9}$/u.test("\u{1F4A9}") // true
/^\u{1F4A9}$/.test("u{1F4A9}") // true (annex b)
```

—Claude

> Le 19 mai 2016 à 19:38, Jordan Harband <[email protected]> a écrit :
> 
> Ah - in that case, no, I would not necessarily expect that the source of a 
> u-mode regex would produce a valid regex in another context without the "u" 
> flag.
> 
> On Thu, May 19, 2016 at 10:18 AM, Claude Pache <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> > Le 19 mai 2016 à 17:54, Jordan Harband <[email protected] 
> > <mailto:[email protected]>> a écrit :
> >
> > I'm not as sure about `eval`, but absolutely `new RegExp(rx.source, 
> > rx.flags)` should always imo reproduce a functionally equivalent regex.
> 
> Sure, but it doesn’t answer the question. I am concerned with, e.g., `new 
> RegExp(rx.source, "u")` where `rx.unicode` is `false`, because u-regexp 
> syntax is stricter.
> 
> —Claude
> 
> 

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to