Regexp.union(pat1, pat2, ...) â new_regexp
Regexp.union(pats_ary) â new_regexp
Regexp.union(pats_ary) â new_regexp
Class Public methods
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)/
Please login to continue.