From: Luca Roma Date: 2008-02-25T03:22:01+09:00 Subject: Re: Get value from string Thanks stefano for the responce There are 2 possible links: http://it.youtube.com/watch?v=PupR5V9aE2s&test=1 http://it.youtube.com/watch?v=PupR5V9aE2s str.match(/v=([^&]*)/)[1] Is your command valid also for the second link? Thanks Stefano Crocco wrote: > Alle Sunday 24 February 2008, Luca Roma ha scritto: >> I have a string that content a link of a youtube page . >> Like: >> http://it.youtube.com/watch?v=PupR5V9aE2s&test=1 >> >> i want get the value of v: >> PupR5V9aE2s >> >> How i can do? >> Thanks > > If you know that the part of the string you want is delimited by v= and > &, you > can use this: > > str.match(/v=([^&]*)/)[1] > > Stefano -- Posted via http://www.ruby-forum.com/.