Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 正则表达式,获取两个字符之间的字符串值
myemail@gmail.com
获取“@”和“。”之间的模式是什么?在这个字符串中?在这种情况下,它将获得“gmail”。
我相信这是...
preg_match("'@(.*?)\.'si", $source, $match);
$email = 'myemail@gmail.com'; $gmail = preg_match('/@([^\.]*)\./', $email, $m) ? $m[1] : false;