Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $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
- }
Add Comment
Please, Sign In to add comment