Vote count:
0
could anyone expalin me how this is working what is the role of @ further there is nothing preceeding character before (?:http) then why "?' this is used since it means preceeding character must appeat once or not at all..
<?php
// get host name from URL
preg_match('@^(?:http://)?([^/]+)@i',
"http://ift.tt/13yRSMW", $matches);
$host = $matches[1];
// get last two segments of host name
preg_match('/[^.]+\.[^.]+$/', $host, $matches);
echo "domain name is: {$matches[0]}\n";
?>
asked 31 secs ago
working of regex to filter domain name
Aucun commentaire:
Enregistrer un commentaire