• Returns whether the source text can be tested by the given regex, and resets the last index of the regex

    Parameters

    • Optionalregex: RegExp

      the regex to match

    • Optionaltext: null | string

      the source text to check

    Returns boolean

    whether the source text can be tested by the given pattern, and resets the last index of the regex