Link to home
Start Free TrialLog in
Avatar of tbboyett
tbboyettFlag for United States of America

asked on

java string and wildcards

How can I check that a string is a valid email address?  Would I use some kind of wildcard to check?

for example lets say we have an email address:  someone@yahoo.com

and i want to make sure the string has some text, then an @ symbol, then some text, then a period, then some text.
The idea of wild card that I was thinking would be something like this:

String email = "someone@yahoo.com";
if(email.compareToIgnoreCase("'%@%.%'") == 0) {
    System.out.println("Email is valid");
}

I haven't tested this just because I don't know if java supports wildcards.

Any suggestions would be greatly appreciated
ASKER CERTIFIED SOLUTION
Avatar of MilanKM
MilanKM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial