App tester
App tester

Reputation: 139

regexpression for url is not working

$uri="https://www.facebook.com/video/embed?video_id=533502940004820";
$services['facebook']['regexp'] = array('/^https?:\/\/(www\.)?facebook\.com\/video\/embed?video_id=([0-9]*)/', 2);
$services['facebook']['img'] = "https://graph.facebook.com/%s/picture";
$i=1;

    $support=0;
    foreach($services as $service => $s) {
        if(preg_match($s['regexp'][0], $uri, $matches, PREG_OFFSET_CAPTURE) > 0) {
            $support = $i;
        }
        $i++;
    }
    if($support==0){
        echo "This website doesn't support now!";
    }

This is my code but when i match it with https://www.facebook.com/video/embed?video_id=533502940004820 it is not working

Can anyone tell me what is wrong here?

Upvotes: 0

Views: 37

Answers (1)

CodeZombie
CodeZombie

Reputation: 5377

embed?video stands for "one or zero 'd'". You have to escape it.

Upvotes: 1

Related Questions