|
|
3.3. Escaping Special CharactersThe 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. |
|
|