October 2006
Intermediate to advanced
888 pages
16h 55m
English
The class method Regexp.escape escapes any characters that are special characters used in regular expressions. Such characters include the asterisk, question mark, and brackets.
str1 = "[*?]" str2 = Regexp.escape(str1) # "\[\*\?\]"
The method Regexp.quote is an alias.
Read now
Unlock full access