Jano Svitok wrote: > On 8/13/07, Peter Bailey <pbailey / bna.com> wrote: >> >> What I want: >> <SUB.HEAD4>Normandy Group LLC(/SUB.HEAD4> > > This works for me (I've used \1): > > require 'test/unit' > class TestGsub < Test::Unit::TestCase > def test_replace > line = "<registrantName>Normandy Group > LLC</registrantName>" > > line.gsub!(/<registrantName>(.*)<\/registrantName>/,'<SUB.HEAD4>\1</SUB.HEAD4>') > assert_equal(line, '<SUB.HEAD4>Normandy Group > LLC</SUB.HEAD4>') > end > end > > Note that you have (/SUB.HEAD4> instead of </SUB.HEAD4> (the > parenthesis) Thank you, Jano. Yes, this worked for me now. Cheers. -- Posted via http://www.ruby-forum.com/.