method
union
union(*args)
public
Return a Regexp object that is the union of the given patterns, i.e., will match any of its parts. The patterns can be Regexp objects, in which case their options will be preserved, or Strings. If no patterns are given, returns /(?!)/. The behavior is unspecified if any given pattern contains capture.
Regexp.union #=> /(?!)/ Regexp.union("penzance") #=> /penzance/ Regexp.union("a+b*c") #=> /a\+b\*c/ Regexp.union("skiing", "sledding") #=> /skiing|sledding/ Regexp.union(["skiing", "sledding"]) #=> /skiing|sledding/ Regexp.union(/dogs/, /cats/i) #=> /(?-mix:dogs)|(?i-mx:cats)/