不是不是,没有后者。是
preg_replace("/^:([0-9a-zA-Z_]{0,10}):$/","\\1",":tes_t2:")

解决方案 »

  1.   

    echo preg_replace("/^:([0-9a-zA-Z_]{0,10}):$/","\\1",":tes_t2:"); //out tes_t2
    有什么问题吗?
      

  2.   

    echo preg_replace("/^:([0-9a-zA-Z_]{0,10}):$/","\\1",":tes_t2::haha::aaaddd::a2sdfs:"); 
    这样就不能替换了。
      

  3.   

    当然不能啦!你是这样设定的嘛
    echo preg_replace("/:([0-9a-zA-Z_]{0,10}):/","\\1",":tes_t2::haha::aaaddd::a2sdfs:"); 
    //out tes_t2hahaaaaddda2sdfs
      

  4.   

    函数参考下
    Regular Expression Functions (Perl-Compatible)
    找Pattern Syntax