mardi 5 mai 2015

I need a regex that would tell me if URL starts with http://i.imgur.com

So I need a regex that I can use in preg_replace that'll tell me if $string starts with http:// (or https) i.imgur.com/

Any help? I'm not that good with regex heh

so far what I have:

<?php
$url = "httPs";
if (preg_match('#^http#i', $url) === 1) {
// Starts with http (case insensitive).
die('ye');
}
else
{die('nop');}
?>

Aucun commentaire:

Enregistrer un commentaire