Created
January 19, 2016 06:12
-
-
Save arpitr/08118e59ff1dfba88556 to your computer and use it in GitHub Desktop.
Regular Expression for safe file name input by user.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ^ matches the beginning of the string. | |
// \w matches a "word" character (A-Z, a-z, 0-9, and _ only). | |
// The "+" sign means "one or more." | |
// \. matches a single dot. | |
// And the final $ matches the end of the string. | |
$safeFilename = '/^\w+\.\w+$/'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment