Function regExpUnion

  • Category

    Combines several regular expressions into a new one that matches any of them.

    Time complexity: O(n)

    Space complexity: O(1)

    Parameters

    • Rest...regExps: RegExp[]

      Regular expressions to get the union of

    Returns RegExp

    A new regular expression

    Regular expressions

    regExpUnion(/[a-z]/, /\d/); // /([a-z])|(\d)/