Function regexIsValidFlags

  • Checks if the provided string is a valid regular expression flag.

    Parameters

    • flags: string

      The string to be checked.

    Returns boolean

    A boolean indicating whether the string is a valid regular expression flag. Checks if a string is a valid regex flags string.

    Remarks

    This function checks if the provided string contains only the characters 'g', 'i', 'm', 's', 'u', 'y' and if there are no duplicate characters.

    Example

    regexIsValidFlags('gim') // true
    regexIsValidFlags('gmisuy') // false

Generated using TypeDoc