escape

Regexp.escape(str) รข string
Class Public methods

Escapes any characters that would have special meaning in a regular expression. Returns a new escaped string, or self if no characters are escaped. For any string, Regexp.new(Regexp.escape(str))=~str will be true.

Regexp.escape('\*?{}.')   #=> \\\*\?\{\}\.
doc_ruby_on_rails
2015-05-05 03:56:07
Comments
Leave a Comment

Please login to continue.