From: Li Chen Date: 2008-01-11T06:02:58+09:00 Subject: Re: string extraction yermej wrote: > On Jan 10, 2:38?pm, Li Chen wrote: >> -- >> Posted viahttp://www.ruby-forum.com/. > > new_string = old_string.gsub(/[^A-Z]/, '') > > That substitutes '' (empty string) for any character that is not (^) a > capital letter (A-Z). > > To do the same thing in place: old_string.gsub!(/^A-Z]/, '') Hi yermej, One more question: How do I change all the As into T and all the Ts into A in the old sttring? old_s="AAATTAA" new_s="TTTAATT" thanks, Li -- Posted via http://www.ruby-forum.com/.