From: Simon Krahnke Date: 2007-08-14T07:04:58+09:00 Subject: Re: confused by back refs in gsub * Felix Windt (22:18) schrieb: > I'm leaving off the opening bracket '<': > > line.gsub!(/registrantName>/, 'SUB.HEAD4>') > > So that it will match the opening as well as closing statement. As well as any substring "registrantName>". And well-formed XML won't guarantee that only "" and "" will contain that. gsub!(/(<\/?)registrantName>/, '\1SUB.HEAD4>') should do. But again, CDATA-sections and comments may well contain these strings. I'd use XSLT or some SAX-Library if it has to be ruby. mfg, simon .... l