From: Peter Bailey Date: 2007-08-14T04:18:05+09:00 Subject: Re: confused by back refs in gsub Jano Svitok wrote: > On 8/13/07, Peter Bailey wrote: >> >> What I want: >> 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 = "Normandy Group > LLC" > > line.gsub!(/(.*)<\/registrantName>/,'\1') > assert_equal(line, 'Normandy Group > LLC') > end > end > > Note that you have (/SUB.HEAD4> instead of (the > parenthesis) Thank you, Jano. Yes, this worked for me now. Cheers. -- Posted via http://www.ruby-forum.com/.