2012-03-22 109 views
-1

preg_match說我錯過了一個括號。但是哪裏? :(preg_match編譯失敗:缺少括號

preg_match('/^(Lam)\/(\d+)\.(\d+) \(Trent/', $string, $matches) 
+0

是我的回答足夠如果是這樣,你能接受它如果不是,有什麼沒」?請參閱常見問題解答中的[如何在此處提問?](http://stackoverflow.com/faq#howtoask)。 – 0b10011 2012-04-20 16:45:31

回答

0

這可能與正則表達式中的反斜槓的問題試試下面的代碼來代替:?

<?php 
// Notice the double backslashes 
preg_match('/^(Lam)\\/(\d+)\\.(\d+) \\(Trent/', $string, $matches)