From: Robert Klemme Date: 2007-08-20T22:54:35+09:00 Subject: Re: regex not gsubbing for me. 2007/8/20, Peter Bailey : > 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. Not sure whether that may be related but I'd use (.*?) instead of (.*). Otherwise you will get just one replacement starting at the first in your file and ending at the last . Btw, are you doing some kind of XML to HTML translation? Then maybe XSLT is for you. Kind regards robert