Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Posts
    135
    Thanks
    1
    Thanked 0 Times in 0 Posts

    I give up on preg match...

    For the life of me, I can't figure out how to parse a simple url out of this...

    Code:
    //$_POST[video]
    <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>

    Code:
    	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];

  • #2
    Regular Coder
    Join Date
    Jul 2007
    Posts
    135
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Again... Not working..

    Code:
    "/(^http)([0-9a-zA-Z./])(\"$)/i"

  • #3
    Regular Coder
    Join Date
    Jul 2007
    Posts
    135
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Code:
    	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...

    http://www.youtube.com/v/nYH9b48msbs\">-

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

  • #4
    Regular Coder
    Join Date
    Jul 2007
    Posts
    135
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

    http://phpro.org/tutorials/Introduct...PHP-Regex.html

  • #5
    Regular Coder
    Join Date
    Jul 2007
    Posts
    135
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Nm, got it... Finally, Orilley is the only person who knows wtf is going on!

    "'(http)(.*?)(?=\\\\)'si"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •