...

View Full Version : Help with stopping preg_match



Suffice
05-21-2011, 10:48 PM
How would I go about getting this to grab anything after the /swf/, except stop once it gets to a " & " or a " " " while excluding them from the $id as well?


$s = file_get_contents($VideoSite);

$patterns = array();
$patterns[] = '<embed[^>]+src="(.+?)"';
$patterns[] = '<iframe[^>]+src="(.+?)"';
$patterns[] = '<object[^>]+src="(.+?)"';

$patterns = "#(?:" . implode("|", $patterns) . ")#si";

preg_match_all($patterns, ($s), $m);
if (!empty($m[0]))
{
$edata = array();
foreach($m[0] as $match)
{
//Getting it to stop at the & or " here:
if (preg_match('#http://www.dailymotion.com/swf/(.+)"#si', $match, $id))
$edata[] = "[dailymotion " . $id[1] . "]";

}



If this could be explained, thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum