From: William James Date: 2006-02-13T16:58:25+09:00 Subject: Re: Cutting a piece of text Zdebel wrote: > Helo ! > I've started to learn ruby and I'm amazed with it. Now I have a problem > that I can't solve. If I have a string like this: > " Lalalalala " how can I > cut the " artist=XXX album=XXX title=XXX" part, so it would look like: > " Lalalalala " Could you please help me ? > > -- > Posted via http://www.ruby-forum.com/. p " Lalalalala ". sub(/\s+[^<>]*(?=>)/, '' ) p " Lalalalala ". scan( /\G ( [^<]+ ) | \G ( < \S* ) [^>]* ( > ) /x ). flatten.compact.join