From: Ganesh Gunasegaran Date: 2007-04-26T07:21:10+09:00 Subject: Re: gsub question The slash in the txt variable should be escaped The escaped version is as below txt = "Messages posted to this group will make your email address visible to anyone on the Internet. \\" puts txt.gsub('\\' , ' ') Of course if you are reading the content directly from a file you need not escape the slashes explicitly gg.txt ~~~~ Messages posted to this group will make your email address visible to anyone on the Internet. \ gg.rb ~~~~ string = File.read("gg.csv") p string.gsub("\\", "") Cheers, Ganesh Gunasegaran. On 26-Apr-07, at 3:35 AM, traktorman@gmail.com wrote: > Hello, > > i'm new to ruby, and working mostly with text. > i have this very simple program that reads a file and replaces all '\' > with a whitespace. (rtf to txt conversion is causing an endless > occurence of \'s). > 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 > > i'd like to know what i'm doing wrong, or is there another way of > doing it properly. > > thanks > t > >