From: Chris Gernon Date: 2006-10-27T02:06:44+09:00 Subject: Re: Question about strings Grant Hollingworth wrote: > The best solution I could find was to match the space before the > quotation mark. > >>> "I am Will's string!".gsub(/(?=')/,'\\') > => "I am Will\\'s string!" Using a block for the substitution appears to work: >> "This is Will's string!".gsub(/(\')/) {|m| '\\' + m} => "This is Will\\'s string!" -- Posted via http://www.ruby-forum.com/.