3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = array( '<title>Something (TV 1999-2000)</title>' ,'<title>Something (1999-2000)</title>' ,'<title>Something (19999-2000)</title>' ,'<title>Something (99000)</title>' ,'<title>Something (2000)</title>' ); $regex = "/<title>.*?\(.*?(\d{4}).*?\)<\/title>/is"; foreach($items AS $k => $str) { preg_match($regex, $str, $matches[$k]); } print_r($matches); ?>

preferences:
40.36 ms | 402 KiB | 5 Q