Possible Duplicate:
Regex, get string value between two characters
myemail@gmail.com
What is the pattern to get what's between '@' and '.' in this string? In this case it would get 'gmail'.
Possible Duplicate:
Regex, get string value between two characters
myemail@gmail.com
What is the pattern to get what's between '@' and '.' in this string? In this case it would get 'gmail'.
$email = 'myemail@gmail.com';
$gmail = preg_match('/@([^\.]*)\./', $email, $m) ? $m[1] : false;