From: Brian Candler Date: 2007-05-05T03:34:05+09:00 Subject: Re: Question regarding tr method in Strings Class On Fri, May 04, 2007 at 10:47:15PM +0900, Logan Capaldo wrote: > On 5/3/07, Brian Candler wrote: > > > > > >If you want this in a single step, hmm, how about: > > > >REPLACE = { > > "," => " ", > > "'" => "", > >} > >REPLACE_RE = /#{REPLACE.keys.map {|k| Regexp.escape(k) }.join("|")}/ > > > Tweak: > REPLACE_RE = Regexp.union(*REPLACE.keys) Ooh, shiny.