Should RegExp(regexp, flags) always return a functional RegExp for reasonable values of flags?

Jordan Harband ljharb at gmail.com
Thu May 19 17:38:45 UTC 2016


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 <claude.pache at gmail.com>
wrote:

>
> > Le 19 mai 2016 à 17:54, Jordan Harband <ljharb at gmail.com> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160519/e67233ec/attachment.html>


More information about the es-discuss mailing list