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

Claude Pache claude.pache at
Thu May 19 17:18:15 UTC 2016

> Le 19 mai 2016 à 17:54, Jordan Harband <ljharb at> 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.


More information about the es-discuss mailing list