Answer to Question #26194 in Programming & Computer Science for Mahendra

Question #26194
i need a help for getting free script for valdiate any email address is valid or not
for e.g suppose i enter xxxx@yahoo.com than i want to know whether this email is availabel or not in yahoo and i want to check any domain's email address
1
Expert's answer
2013-03-13T10:06:17-0400
You should use regular expressions. Example:
public class test
{

publicstatic void main(String[] args) {
System.out.println(isValidEmail("xxxx@yahoo.com"));
}

publicstatic boolean isValidEmail(String email) {
Patternp = Pattern
.compile("^[A-Za-z0-9.%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,4}");
Matcherm = p.matcher(email);
returnm.matches();
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS