From: Peter Bailey Date: 2007-08-20T23:18:50+09:00 Subject: Re: regex not gsubbing for me. Robert Klemme wrote: > 2007/8/20, Peter Bailey : >> 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 Robert- Yes, this worked, using (.*?) instead of (.*). I've always been putting that "?" at the end, before the closing "/." And, it never seemed to work properly. This is great. Thank you very much! Yes, I am converting XML to SGML and, yes, I have had that suggestion before, of using XSLT. I'm just learning Ruby now, though, so, I'm somewhat hesitant to learn yet another scripting language. Although, I've heard that it isn't hard to learn. I'll take a look when I have time. (-: -Peter -- Posted via http://www.ruby-forum.com/.