Creates a new copy of a regular expression with modified flags.

This function is valid in v2.0.0 to v2.20.0. This function has been downloaded 22 times.


{RegExp} rgx
The regular expression to be duplicated with modified flags.
{string=} modifiers Optional
Specifies how to modify the flags of the duplicate of rgx. The standard flags are of course g for global, i for ignoreCase and m for multiline. In some environments other flags are also available. In order to assure that the duplicate will have specified flag you can just add the flag character (optionally you can prefix it with a +) to the string. In order to assure that the duplicate will exclude a specified flag you can enter - followed by the flag character in this string. In order to toggle the flag in the duplicate you can prefix the flag character with !. For example "g-i!m" (which is the same as "+g-i!m") will ensure the g flag is included, ensure the i flag is excluded and toggle m.


Returns a duplicate of rgx with modified flags as specified by the modifiers string.