I am working on an automation project.In that I have to fetch all the email address from the span text which will be having characters of more than 200.But the email address are not in regular expression format instead it is showing as Eg:- xxx(at)abc(dot)com aaa(at)yyy(dot)com
So How can I extract these sort of contents from a paragraph like below
aaaaaaaaa aaaaaaa aaaaaaaaaaaa aaaaaaaa aaaaaaaa xxx(at)abc(dot)com bbbbbb bbbbbbbb bbbbbbbbbbbb bbbbbbbbbbbbbbbbbbb ggggggggggggg aaa(at)yyy(dot)com ccccccccccccccc ddd ccc eeeeee fff ggggg 11111(at)22222(dot)com.
public class Foxpro_Class {
public static void main(String[] args)
{
String emailStr="aaaaaaaaa aaaaaaa aaaaaaaaaaaa aaaaaaaa aaaaaaaa xxx(at)abc(dot)com bbbbbb bbbbbbbb bbbbbbbbbbbb bbbbbbbbbbbbbbbbbbb ggggggggggggg aaa(at)yyy(dot)com ccccccccccccccc ddd ccc eeeeee fff ggggg 11111(at)22222(dot)com zzzzzz";
validate(emailStr);
}
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
Pattern.compile("^[A-Z0-9._%+-]+(at)[A-Z0-9.-]+(dot)[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
public static boolean validate(String emailStr) {
Matcher matcher = VALID_EMAIL_ADDRESS_REGEX .matcher(emailStr);
System.out.println(matcher.toString());
return matcher.find();
}
}