From: 7stud -- Date: 2011-05-11T06:43:16+09:00 Subject: Re: gsub and multiple-replacement require 'stringio' str =<<'ENDOFSTRING' Record for WendyQ with girlpower@google.com from Germany Record for bohH with bogH@yahoo.com from USA ENDOFSTRING file = StringIO.new(str) file.each do |line| words = line.split(' ') words[2] = '***' words[4] = '***' words[6] = '***' puts words.join(' ') end --output:-- Record for *** with *** from *** Record for *** with *** from *** -- Posted via http://www.ruby-forum.com/.