From: Stefan Rusterholz Date: 2007-08-20T22:37:37+09:00 Subject: Re: regex not gsubbing for me. Peter Bailey wrote: > Hi, > Can someone please explain to me why this simple regex substitution > won't work? > > Source data file: > Reauthorization of collaborative weather modification > research program within Department of Commerce/NOAA Weather modification > research appropriations > > My script line: > xmlfile.gsub!(/(.*)<\/purpose>/mi, ' face="b">Purpose: \1') > > The data stays the same. The line isn't converted. > > Thanks a lot, > Peter Your operation changes the string object in memory. Not the file. You have to write the string back to the file to have it changed there. Regards Stefan -- Posted via http://www.ruby-forum.com/.