Method: Regexp#+

Defined in:
lib/core/facets/regexp/op_add.rb

#+(other) ⇒ Object

Add regular expressions.

/a/ + /b/ == /(?-mix:a)(?-mix:b)/

Functionally equivalent to:

/ab/

CREDIT: Tyler Rick



12
13
14
15
# File 'lib/core/facets/regexp/op_add.rb', line 12

def +(other)
  other = Regexp.escape(other) if other.is_a?(String)
  /#{self}#{other}/
end