Require regular expression for matching below string
'/test_25-5?page=5'
Require regular expression for matching below string
'/test_25-5?page=5'
preg_match is what you're looking for and Understanding RegEx
pseudo code (I have not tested the code it's an example to help you in the right direction)
$string = '/test_25-5?page=5';
// The "i" after the pattern delimiter indicates a case-insensitive search
if (preg_match("/\/[a-z]+_[\d]+\?[a-z]+=[\d]+$/i", $string)) {
echo "A match was found.";
} else {
echo "A match was not found.";
}