唠叨的回答

$current = 'D:\web\mambog_corp\sql\67-12-23';
$current = preg_replace("#\\\([0-9]+)#i", "/\\1", $current);

\' and '\\' will both end up as a single '\' in the string which
effectively reads \( to the preg parser which means you escape the '('
and so don't use it's function to capture characters for backreferences
which renders the following ')' illegal since it tries to close a not
opened '('. Therefore, \ -> \ and \\ -> \ so you need \\\ to get \\ in
the string so you don't escape the (. Clear ? :)

 

http://bugs.php.net/bug.php?id=16537&edit=1




 

Posted on 2005-12-23 13:05  古代  阅读(880)  评论(2编辑  收藏  举报