Function regexClone

  • Clones a regular expression.

    Parameters

    • regex: RegExp

      The regular expression to clone.

    Returns RegExp

    A new RegExp instance with the same source and flags as the provided regular expression.

    Remarks

    This function creates a new instance of the RegExp using the source and flags of the provided regular expression.

    Example

    /abc/gi;;
    //=> /abc/gi
    regexClone(/abc/gi);;
    //=> /abc/gi

Generated using TypeDoc