A valid email is of the format: [email protected] The name can be a set of ‘atoms’ separated by dots. single or double quotes and any character inside the quotes Now, to the domain part. MUSEUM .travel, .international or even .vermögensberatung For example all the following email addresses are valid: Source The sad truth is that despite the complex regular expression validation, the email may not be existing, so can still be invalid for practical purposes.Most email validation checks assumes that the top level domain can have up to 4 characters. You have just validated the format – not its existence.Most Java Script form validation libraries are large, and often require other libraries like j Query. For example, Mail Chimp's embeddable form includes a 140kb validation file (minified).
I hope this article is useful for all students and beginners.A simple six digit zipcode can be checked using regular expression which matches exactly six digits : /^d$/ Another way can be /^[0-9][0-9][0-9][0-9][0-9][0-9]$/ , for zipcode with dash in between it can be /^\d-? There may be some form fields whose values must be strictly alphabetic characters, eg: Name, Country, State.In the below demo the regular expression looks for one or more uppercase or lowercase letters within the character class [A-Za-z], followed with an end of a line anchor $ Some undesired spaces and dashes from the user input can be removed by using the string object replace() method.An USA phone number has ten digits, it comprises of : a three digit area code, subscriber number of seven digit. : To check username consists of one or more dashes or word characters grouped by parentheses, followed by a literal period. ) : username can consists of more than one set of word characters seperated by a single dots.The area code may have a parentheses around the area code, and dashes or spaces seperating the numbers in the subscriber number. @ : To check for @ symbol required in the email address.(([\-\w] )\.?