可以将例如这样的email地址:eA株式会社<[email protected]>分开的正则表达式,拆分为”eA株式会社" 和<[email protected]>两部分
另外一个[email protected] (company name) 拆分为[email protected]和(company name)两部分3Q....

解决方案 »

  1.   


    $str = "eA株式会社 <[email protected]>";
    //$str = "[email protected] (company name)";
    preg_match_all("/([^\(\)<>]+)/i", $str, $matches);//注意$matches数组得到的值,要用trim去掉左右的空格
      

  2.   

    用正则么?用空格把字符串split就……好了吧。
      

  3.   


    $str1 = "eA株式会社 <[email protected]>";
    $str2 = "[email protected] (company name)";$re1 = preg( $str1 );
    print_r( $re1 );
    $re2 = preg( $str2 );
    print_r( $re2 );function preg( $content, $match = '' )
    {
        if( empty( $match ) )
       {
            $match="\<|\(|\[";
        }
        $re = split( $match, $content );
        return $re;}
    写了一种方法,希望楼主参考一下..