First of all, I want to say that I know there are a bunch of related questions, but after trying the solutions given in these topics, I still have something that doesn't work for my code..
I need a regex for extracting the youtube vid from this specific type of Url:
http://www.youtube.com/user/thedailyenglishshow#p/u/0/B3-Bn4aUXTY
My php code and patterns used look like this:
public function retrieveUserVideo($data) {
$url = $data;
$pattern = '/[^\/]+$/';
//$pattern = '(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+';
preg_match($pattern, $url, $matches);
$result = $matches[1];
return $result;
}
I have checked these patterns at 'http://gskinner.com/RegExr/', and they seem to work, but i receive an empty result string with the first pattern, while with the second one i get an unknown modifier '[' error. If i put the pattern between '#' i get the empty string result.
Any ideas of what's wrong with the code shown? Please help me, im really desperate!