用正则表达式:$str = "Item #160290031829 - Notification of an Instant Payment Received from pimbarola ([email protected])";
preg_match("/([a-z0-9_\\-]+[a-zA-Z0-9\\-._]*)\\s*\\(([a-z0-9_\\-]+[a-zA-Z0-9\\-._]+@[_a-z0-9\\-.]+)\\)/i", $str, $matches);
var_export($matches);

解决方案 »

  1.   

    $str=……
    $son=explode('from ',$str);
    $son2=explode(' (',$son[1]);
    $pimbarola=$son2[0];
    $son3=substr($son2[1],1);
    $son4=explode(')',$son3);
    $pummarola=$son4[0];
    辅助变量是多了点,但是只有这样了
      

  2.   


    <?php
    $str = "Item #160290031829 - Notification of an Instant Payment Received from pimbarola ([email protected])";
    if(preg_match('/.*\s+(\w+)\s+\(([\w@\.]+)\)$/i', $str, $matches))
    {
    echo $matches[1] .  "<br/>"  .  $matches[2];
    }
    ?>
      

  3.   

    <?php
    $str = "Item #160290031829 - Notification of an Instant Payment Received from pimbarola ([email protected])";
    if(preg_match('/.*\s+(\w+)\s+\(([\w@\.]+)\)$/i', $str, $matches))
    {
        echo $matches[1] .  "<br/>"  .  $matches[2];
    }
    ?>