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:
> "<lyrics artist=XXX album=XXX title=XXX> Lalalalala </lyrics>" how can I
> cut the " artist=XXX album=XXX title=XXX" part, so it would look like:
> "<lyrcis> Lalalalala </lyrics>" Could you please help me ?
>
> --
> Posted via http://www.ruby-forum.com/.

p " <lyrics artist=XXX album=XXX title=XXX> Lalalalala </lyrics>".
sub(/\s+[^<>]*(?=>)/, '' )

p " <lyrics artist=XXX album=XXX title=XXX> Lalalalala </lyrics>".
scan( /\G ( [^<]+ ) | \G ( < \S* ) [^>]* ( > ) /x ).
flatten.compact.join