Created
October 4, 2017 20:16
-
-
Save KimSarabia/2ddf7a7589255fe97846a944e025a4cc to your computer and use it in GitHub Desktop.
Reject Special Characters Regex
This file contains hidden or 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
Determine if any characters are not in character classes a-z, A-Z or 0-9 | |
This will also treat é or similar characters as rejected symbols. | |
if(!/[^a-zA-Z0-9]/.test($(this).val())) { | |
$("#passwordErrorMsg").html("OK"); | |
} | |
Source: https://stackoverflow.com/questions/19932596/regex-to-not-allow-special-characters-javascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment