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 1 of 1
  1. #1
    New Coder
    Join Date
    May 2011
    Posts
    39
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Question Help with stopping preg_match

    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?

    PHP Code:
    $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!
    Last edited by Suffice; 05-21-2011 at 11:50 PM.


 

Posting Permissions

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