sffsf(5545555)
帮忙用正则表达式把括号里面的内容提出来
返回结果是5545555
 php的
谢了

解决方案 »

  1.   

    preg_match('/\(\d+\)/', $string, $matches);
    print_r($matches);
      

  2.   

    preg_match('/\(\d+\)/', $string, $matches);
    print_r($matches);
     
     
    里面带字母就不行了,能不能改下
      

  3.   

    $str = "sffsf(5545555)";
    preg_match("/\(.*\)/",$str,$match);
    var_dump($match);
      

  4.   

    再帮下把dsghdgf<84556632>这种情况也提出来
    返回结果84556632
      

  5.   

    preg_match('/\((.*?)\)/', $string, $matches);
    print_r($matches);
      

  6.   

    preg_match('/<(.*?)>/', $string, $matches);
    print_r($matches);
    下面的兼容 (), <>
    preg_match('/\(|<(.*?)\)|>/', $string, $matches);
    print_r($matches);
      

  7.   

    $str = "sffsf(5545555)";
    preg_match('/(?<=\()\d+(?=\))/', $str, $matches);
    print_r($matches);//多个的时候
    $x = preg_replace('/^[^(]+\(([^)]+)\).*$/',"$1",$str);
    print($x);//如果你只有1个括号需要取