I need to implement a regular expression in my asp.net mvc(C#) application using jquery.
I have a sign in form, in which i need to validate the fields with the required and regular expression.
Putting more clearly, I have Username
and Password
fields in my Sign in form. I need to validate as required first, and if the user entered any value, then i need to validate with the regular expression.
For ex.: The Username
must be minimum 5 characters and no special characters, if entered invalid values. it should say Please enter a valid Username with atleast 5 characters and no special characters
.
The Password must be minimum 5 characters and atleast 1 special character, 1 numeric, if entered invalid value, it should say Please enter a valid password with atleast 5 characters and should contain one numer and special character
So i need to give custom messages for each of the fields for required and regular expression.
Is there and common plugin or function to use for regular expression in jquery?