Lucky Nl wrote: > But if i gave with littile modifiaction at endof line is enetered with > chars <p>dada ddsa</p>" > > str giving result nil Yes, the result of gsub! is nil if no change is made; but the string remains as it was. irb(main):001:0> str = "abc" => "abc" irb(main):002:0> str.gsub!(/d/,"") => nil irb(main):003:0> str => "abc" It's intended so you can say if str.gsub! ... # it changed else # it didn't end If you use gsub instead of gsub!, then it always returns the resulting string. irb(main):004:0> str2 = str.gsub(/d/,"") => "abc" -- Posted via http://www.ruby-forum.com/.