How can we extract string "w3answers.com" from a string mailto:info@w3answers.com using regular expression of PHP ?
You can't request more than 20 challenges without solving them. Your previous challenges were flushed.
Answer:
<?php
$w3 = "mailto:info@w3answers.com";
preg_match('|.*@([^?]*)|', $w3, $w3output);
echo $w3output[1];
?>
or explode
Regular expressions are nice, but sometimes they are just not needed..
eg
$w3 = "mailto:info@w3answers.com";
list($person,$host) = explode('@',$w3); will do the job without as much overhead;
Post new comment