From: Lyle Johnson Date: 2007-04-26T07:17:28+09:00 Subject: Re: gsub question On 4/25/07, traktorman@gmail.com wrote: > the way i do it : > > txt = "Messages posted to this group will make your email address > visible to anyone on the Internet. \" > puts txt.gsub('\' , ' ') > > produces an error: > test.rb:1: unterminated string meets end of file Within a double quoted string (like your txt) the backslash character (\) sets up an escape sequence; so the trailing \" is interpreted as an embedded quote mark. You need to use two backslashes to get the effect that you're after, e.g. txt = "Messages posted to this group... on the Internet. \\" puts txt.gsub('\\', '') For more info, see the "Strings" section of this chapter from Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_stdtypes.html Hope this helps, Lyle