PHPでpreg_matchを使用して同じ文字列の複数の出現を見つけるための正規表現の正しい構文は何ですか?
たとえば、次の文字列が次の段落で 2 回出現するかどうかを調べます。
$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";
}