On 2010-01-25, lalawawa <usenet / ccjj.info> wrote:
> irb(main):005:0> a.gsub(/([\'\?])/, '\\\\\1')
>=> "Can\\'t we\\?"

This is probably what you want -- keep in mind that irb will show
you escaped backslashes if there's a single backslash in the string.

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam / seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!