So we should use a new regular expression to forbid underscopes. Next, we want to permit only passwords that contain letters and at least one numeral.
For that we use the seacrh() method and two more regular expressions: /(a-z) / and /(0-9)/.
If its not blank, we check the length of the string and permit only usernames that are between 5 and 15 characters.
Next, we use the Java Script regular expression /\W/ to forbid illegal characters from appearing in usernames.
No need to write even a single Java Script line for simple form validation.
View example » Parsley is shipped with more than a dozen useful validators.
If the element complies than sufunction returns an empty string.
Otherwise it returns a message describing the error and highlight appropriate element with yellow.