Код: Выделить всё
$path1 = 'user/3/categories';
$path1 = 'user/3';
$re = /^user\/[0-9]+\/?$/;
$match = preg_match($re, $path1);
echo $match;
$match = preg_match($re, $path2);
echo $match;
Подробнее здесь: https://stackoverflow.com/questions/167 ... -like-in-j