From: Jeff Wood Date: 2005-11-27T23:19:42+09:00 Subject: Re: String#to_rx ? ------=_Part_19139_12629658.1133101175672 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Quite true. And comparatively, Regexp.escape does make more sense. j. On 11/27/05, Stefan Lang wrote: > > 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 > > -- "Remember. Understand. Believe. Yield! -> http://ruby-lang.org" Jeff Wood ------=_Part_19139_12629658.1133101175672--