I hava an application that has a register frame with all relavant textboxes and combo boxes and buttons.now my problem is when i enter an email on the email textbox it saves in my database regardless of the nonsense i’ve put in.i want to make sure that the user puts the correct format of the email e.g “example@blhablha.com” even if this email doesn’t exist but atleast in looks like an email address im using java by the way.
Your help is highly appreciated in advance.
It is really complicated to validate an email address, still there are a bunch of regular expression you can find on the web that will check certain important things, like this one for example
^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$. Unfortunately I don’t think there is an ultimate regex that will catch every “non-sense” you can find in an email address.