modRegExp()

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

This function is valid in v2.0.0 to v2.24.3. This function has been downloaded 62 times.

Parameters

{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

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

Requiring Functions

This function is directly required by the following functions:

  • around()
    Gets the substrings around a specific target.
  • dice()
    Dices up a string splitting it on the passed in delimiter and placing the results in an array while making sure that the empty string is converted to an empty array.