Closed rauschma closed 3 months ago
Thanks, @rauschma! 😊
I agree with the advantages you outlined. But there are also some disadvantages:
RegExp
constructor's syntax./
outside of character classes./
).RegExp.make('g')`.`
or RegExp`(?g).`
). Such discussions have not favored the `/.../g`
format.I'd prefer to avoid ambiguity and conflict between flags by not adding support for the `/.../flags`
format on top of the current approach (flags as an argument). But it would be easy to add a user-side wrapper that drops flags as an argument and supports flags via the string. 😊
(Aside: the content of your comment would make a great FAQ entry – it contains several interesting facts.)
(Very useful library, thanks for creating it!)
Another option for specifying RegExp flags is:
That is equivalent to:
Benefits:
One could make the slashes optional if there are no flags.