Validating email java
a "personal_info" and a domain, that is [email protected] The length of the personal_info part may be up to 64 characters long and domain name may be up to 253 characters. The personal_info part contains the following ASCII characters. To get a valid email id we use a regular expression /^\w ([\.-]? Generic Validator assert Generic Email("[email protected]") //valid email assert !
As the first part, this tell the regex processor to check for another zero or more characters, and it can also contains hyphen, underscore and a dot.
Using regular expression makes it easier to validate data such as email.
After the code you’ll see the meaning of the regular expression used in the code below. This the regex processor that the email address should start with a word character formed of alphanumeric value (a-z 0-9) or it can also be an hyphen, underscore, dot or a plus symbol.
Regular Expressions are supported by many languages.
Sun added support for regular expression in Java 1.4 by introducing regex package.