Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.
Often, email validation code for web applications checks only for the position of @ and period characters, also assuming the @ character will be in the front of period. Did you know you can use a Java Script Regular Expressions method to check email addresses?
The regex for validating the correct email format in line 2 has been borrowed and edited slightly by adding the i flag so that the regex is case-insensitive.The if block in lines 3-6 checks to see if the email address in the first field passes the regex check by invoking the search() method on our email string value.Here is the code for the verify Email() function: This function will return a false value if the user does not type in an email address in the correct format or if the user fails to type in the same email address in both fields.If the email addresses passes both these tests, then the function will return a true value.Nothing exciting here except in line 6 where the on Click event is triggered when the user clicks on the button.
This event will launch the verify Email() Java Script function which will check the user input of the email address.
Consult this page for more details on this problem. For the actual date validity, you should rely on another language.
The following expressions will validate the number of days in a month but will NOT handle leap year validation; hence february can have 29 days every year, but not more. A SIN should also be validated by computing the checksum digit.
The follow snippet is a function I use to validate email addresses.
It is a very simple function which uses a regular expression pattern match to test if a email is of a correct format. This takes in a parameter of the email address and then runs a pattern match against the regular expression.
This method accepts regex expressions as arguments to check the string and returns the position of the specified value in the string or a -1 if no match was found.