On Jan 10, 2:38 ¨Âí¬ Ìé Ãèåî ¼ãèåîß®®®Àùáèïï®ãïí¾ ÷òïôåº > Hi all, > > What is the Ruby way to extract a string like this? > > old_string="5'-AAAAAAAA ¨ÂÃÃÃÃÃà ¨ÂÔÔ ÇÇÇÇ ¨ÂÇÇdz§¢å÷ßóôòéîç½¢ÁÁÁÁÁÁÁÁÃÃÃÃÃÃÃÃÔÔÔÇÇÇÇÇÇÇÇÇ> > Thank you very much, > > Li > -- > 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]/, '')