I have already tried with the following regular expression but it is not working as I expected (xampp php)
$slug = "test123/abc_xyz-001" //this is valid
$reg = '/^[a-zA-Z0-9_-/]+$/';
if (preg_match($reg, $slug)) { // the slug shoul only contain the combination of alpha numeric and _ - /
//It is a valid path
}
else{
//not valid
}
valid case
abc
123
abc12d3
abc_123s
abc-xyz
test123/abc_xyz-001