2012-04-23 27 views

回答

2

這個建議立即進行刪除d與PCRE的最新版本一起工作良好 - 您是否確定將regexbuddy切換爲PCRE模式?

您還需要一個相當新的版本。我的PHP 5.2.6安裝太舊了(PCRE 6.6 2006-02-06),而PHP 5.2.17(8.02 2010-03-19)很好。

這個測試PHP程序:

$a = "it is Sunday tomorrow"; 
preg_match('/(?|(Sat)ur|(Sun))day/', $a, $m); 
print_r($m); 

輸出這樣的:

Array 
(
    [0] => Sunday 
    [1] => Sun 
) 

如果PCRE的版本太舊,你會得到這樣的錯誤:

Compilation failed: unrecognized character after (? at offset 2 
+0

是,我用3.5.1,太老了謝謝。 – tqwer 2012-04-24 15:58:13