Validating e-mail address format
It's been asked plenty of times, but the only answer I found to work for me was the use of regular expressions. I was able to get this bit of code to work:
if (!(t_email.getText ()).matches("\\w*\\.\\w*@\\w*\\.\\w*"))//check for valid and existing e-mail
{
JOptionPane.showMessageDialog (CreateAccount.this,"invalid." ,"Error",
JOptionPane.ERROR_MESSAGE);
}
That code accepts e-mail addresses in the format of: eg.tristan.lee@domain.com Anything liketristan@domain.com is considered invalid for that expression.
I figured thatif (!(t_email.getText ()).matches("[a-z[._-][\\d]]*[@][a-z[.][\\d]]*[.][a-z[.][\\d]]*"))//check for valid and existing e-mail
{
JOptionPane.showMessageDialog (CreateAccount.this,"invalid." ,"Error",
JOptionPane.ERROR_MESSAGE);
}
would work, but it says thattristan@domain..com is valid. You can't have 2 periods before the com/net/org, etc can you?

