From: Zdebel Date: 2006-02-13T02:05:28+09:00 Subject: Re: Cutting a piece of text James Gray wrote: > On Feb 12, 2006, at 10:18 AM, 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 ? > > You can do it with a regular expression like the following, but I > must stress that this isn't very robust: > > >> " Lalalalala ".sub > (/<(\w+)[^>]+>/, "<\\1>") > => " Lalalalala " > > Hope that helps. > > James Edward Gray II :O, wow it works, I wish I knew how this (/<(\w+)[^>]+>/, "<\\1>") regular expresion works :). Anyway thank you, you helped me very much. -- Posted via http://www.ruby-forum.com/.