正則表達式在PHP中使用preg_match查找多個匹配的字符串的正確語法是什麼?PHP preg_match找到多個匹配
例如,如果發現以下段落中出現兩次以下字符串:
$string = "/brown fox jumped [0-9]/";
$paragraph = "The brown fox jumped 1 time over the fence. The green fox did not. Then the brown fox jumped 2 times over the fence"
if (preg_match($string, $paragraph)) {
echo "match found";
}else {
echo "match NOT found";
}
以http嘗試:// WWW .regex-tester.de/regex.html – Gordon 2010-01-08 19:06:47