From: Ernest Ellingson Date: 2001-07-16T21:16:41+09:00 Subject: [ruby-talk:17917] Re: regular expressions and string#sub! At 20:55 7/16/2001 +0900, you wrote: > >>>>> "E" == Ernest Ellingson writes: > >E> Thanks matz. However, I'm still stuck with the question. How does one >use >E> string#sub! to go from aren't to aren\'t? > > >pigeon% cat b.rb >#!/usr/bin/ruby >s = %q{aren't} >s.sub!(/'/, %q{\\\'}) >puts s >pigeon% > >pigeon% b.rb >aren\'t >pigeon% > > >Guy Decoux Thanks to everyone that commented. Page 52 of the Pickaxe book has an excellent description of %q{} etc. Although I read the book some months ago, I'm sure, during my reading, I skimmed over this part thinking, "I'll never encounter a problem where this would apply." Another forecast gone bad! Ernie