View Full Version : I give up on preg match...

08-21-2007, 11:49 AM
For the life of me, I can't figure out how to parse a simple url out of this...

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/nYH9b48msbs">
</param><param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/nYH9b48msbs" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

preg_match('/^(http:\/\/)?([^\/]+)/i', $_POST[video], $matchN);
$url = $matchN[1];
echo $url[0];
echo $url[1];
$url = $matchN[2];
echo $url[0];
echo $url[1];
$url = $matchN[0];
echo $url[0];
echo $url[1];
$url = $matchN[3];
echo $url[0];
echo $url[1];
$url = $matchN[4];
echo $url[0];
echo $url[1];

08-21-2007, 12:02 PM
Again... Not working..


08-21-2007, 12:31 PM
preg_match_all("'http(|[^>]*[^/])>(.*?)'si", $_POST[video], $items);
$array =$items[0];
echo ($array[0]). "-";
printf($array[1]). "-";
printf($array[2]). "-";
printf($array[3]). "-";

This gives me...


Argh.... How can I make it end on the backslash?

08-21-2007, 12:45 PM
Somebody help... This is for a $2000 project I have to get done with in two days, and I can't figure out preg matches. The project is 90% completed.

I can't figure out how to make the preg match STOP at a certain character. None of the guides or tutorials help.


08-21-2007, 12:54 PM
Nm, got it... Finally, Orilley is the only person who knows wtf is going on!


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum