method

union

v1_8_6_287 - Show latest stable - Class: Regexp
union(...)
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 arguments are given, returns /(?!)/.

   Regexp.union                         #=> /(?!)/
   Regexp.union("penzance")             #=> /penzance/
   Regexp.union("skiing", "sledding")   #=> /skiing|sledding/
   Regexp.union(/dogs/, /cats/i)        #=> /(?-mix:dogs)|(?i-mx:cats)/