Validating email address in java
SSN, date, currency symbol) while semantic validation should enforce correctness of their values in the specific business context (e.g.start date is before end date, price is within expected range).If it's well structured data, like dates, social security numbers, zip codes, e-mail addresses, etc.then the developer should be able to define a very strong validation pattern, usually based on regular expressions, for validating such input.
For more information, please see the cheatsheet on Sanitizing HTML Markup with a Library Designed for the Job.
Input validation is performed to ensure only properly formed data is entering the workflow in an information system, preventing malformed data from persisting in the database and triggering malfunction of various downstream components.
Input validation should happen as early as possible in the data flow, preferably as soon as the data is received from the external party.
Please note, email addresses should be considered to be public data.
Many web applications contain computationally expensive and inaccurate regular expressions that attempt to validate email addresses.