I've been given the following regex expression:
if (preg_match_all("'(http://)?(www[.])?(youtube|vimeo)[^\s]+'is",$prova,$n))
{
foreach ($n[3] as $key => $site)
{
$video_links[$site][] = $n[0][$key];
}
However, if I have a string like:
"hello, look at my vimeo video here: http://www.vimeo.com..../ very nice hm?"
Instead of receiving only the url, I'm getting ALSO the word vimeo.
I believe the regex expression is retring more then it should and I would like to retrive ONLY the urls that it finds, not every reference of "vimeo" or "youtube".
Can I request your help in order to narrow the scope of this expression, so that only the URLs are retrieved ?
[^\s]+to\S+(capitalS, which means everything but white-space...