Guest User

Untitled

a guest
Dec 12th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. $slug = "test123/abc_xyz-001" //this is valid
  2.  
  3. $reg = '/^[a-zA-Z0-9_-/]+$/';
  4.  
  5. if (preg_match($reg, $slug)) { // the slug shoul only contain the combination of alpha numeric and _ - /
  6. //It is a valid path
  7. }
  8. else{
  9. //not valid
  10. }
Add Comment
Please, Sign In to add comment