匹配@之前面的部分

$string = 'caoyang@sina.com';

// 匹配@之前的部分
$preg = '/.*(?=@)/';

$status = preg_match_all($preg, $string, $matches);

var_dump($matches);

 

posted on 2019-05-05 13:48  薇薇123456  阅读(72)  评论(0编辑  收藏  举报

导航