【PHP】下らねぇ質問はここに書き込みやがれ 43
■ このスレッドは過去ログ倉庫に格納されています
0165nobodyさん
2007/04/03(火) 21:49:35ID:y3kK4c5q$pattern = '/two (.+)\,/';
preg_match($pattern, $subject, $matches);
print_r($matches);
/* 出力結果:
Array
(
[0] => two potatoes, three carrots,
[1] => potatoes, three carrots
)
*/
正規表現で "potatoes" をマッチさせたいのですが、$matches[1]を見ると
コンマの後ろの文字列までマッチしてしまいます。
どうしてでしょうか?
■ このスレッドは過去ログ倉庫に格納されています