From: "Peña, Botp" Date: 2008-07-16T17:15:21+09:00 Subject: Re: RegEx stuff From: Justin To [mailto:tekmc@hotmail.com] # => ["a\\^b\\^\\^c&def"] # How come the & does not get subbed with '\\&' ?? # I'm basically trying to substitute any special character with # '\\#{special_character}' i'm a block fan, so, irb(main):048:0> b.each do |c| irb(main):049:1* a=a.to_s.gsub(c){"\\#{c}"}.to_a irb(main):050:1> end => ["^", "&"] irb(main):052:0> a => ["a\\^b\\^\\^c\\&def"] using block form of gsub wont give you problems on escaping the escape.. kind regards -botp