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

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.