Skip to content

Instantly share code, notes, and snippets.

@devi
Created July 21, 2011 15:53
Show Gist options
  • Select an option

  • Save devi/1097496 to your computer and use it in GitHub Desktop.

Select an option

Save devi/1097496 to your computer and use it in GitHub Desktop.
regular path validation
<?php
// lower alpha
// alnum followed by alnum or (hyphen, dash or slash between alnum)
function valid_path($path)
{
return (bool) preg_match('/^[a-z0-9]+([-_\/][a-z0-9]+)*$/iD', $path);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment