3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ '5,422 Comments, other text here and stuff', '2 Comments, not great!', '4/4/2009 21 Comments', 'This one is a whopper: 1,234,567,890 Comments' ]; foreach ($strings as $string) { echo preg_match('~\d{1,3}(?:,\d{3})*(?= Comments)~', $string, $m) ? $m[0] : 'no match'; echo "\n"; }

preferences:
23.6 ms | 402 KiB | 5 Q