From: Stefan Lang Date: 2005-11-27T22:33:04+09:00 Subject: Re: String#to_rx ? On Sunday 27 November 2005 14:13, Jeff Wood wrote: > > So in what way is String#escaped better than String#to_rx? > > When I read #to_rx I can only guess at the specifics of the call ( > something to do with regular expressions ... or perscriptions ) ... > but what it's doing to the string, no idea...  when I read #escaped > all the lights light up ... ah, you want an escaped version of the > string. ... But escaped for what purpose? For usage as XML attribute value? Or does it escape special shell characters? Or special regex characters? Or special characters for File.fnmatch? A string can be escaped for many purposes. I'm sure others can come up with more examples. IMO adding a method to String is a bad choice. Either new syntax, or use the existing Regexp.escape, which is a clean and readable solution. Regards, Stefan