$re = '/(\/dev(\/*))/';
$str = '/
/admin
/admin/users
/admin/users::search
/admin/users::add
/admin/users::delete
/admin/database
/admin/database::export
/admin/database::import
/dev
/dev/cache
/dev/cache/local
/dev/cache/remote
/dev/test
/dev/test/unit
/dev/test/unit::execute
/dev/test/e2e
/dev/test/e2e::execute
/stats/
/stats/reports
/stats/reports::download
/stats/reports::print';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php