Method: String#escape_for_regexp

Defined in:
lib/libis/tools/extend/string.rb

#escape_for_regexpObject

Escape string for use in Regular Expressions



33
34
35
# File 'lib/libis/tools/extend/string.rb', line 33

def escape_for_regexp
  self.gsub(/[\.\+\*\(\)\{\}\|\/\\\^\$"']/) { |s| '\\' + s[0].to_s }
end