Apache – Validating email id format

Simple way for validating email id format

Almost every application needs to validate email id format one way or another. Generally it is done with regex or some custom string validation.

Apache commons-validator has an easy way to validate email id for format as given in below example.

Output:

 

Leave a Reply

Your email address will not be published. Required fields are marked *