Need help on Regular Expression to retrieve Email IDs in Error Stack which is like "Some Text some text line break and so on".
Tried using some suggestions provided in Stack overflow. But most of them prints just the error
Below are some of the options which I tried out,
Matcher m = Pattern.compile("\\<([^>]+)\\)").matcher(e.getMessage());
while(m.find())
{
System.out.println(m.group(1));
}
System.out.println(e.getMessage().split("<(<^>>+)>"));
exception.getMessage().split("\\[([^]]+)\\]")
exception.getMessage().split("\\<\"(.*?)\"\\>")
exception.getMessage().split("<(<^>>+)>")
Actual Resulting String array contains only one value and prints the entire stack as below,
Failed messages: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.0.0 <abc@def.com>... User unknown
;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.0.0 <def@ghi.com>... User unknown
;
PS: There is no \ in the email id. Stack overflow did not accept the character followed by <. So added escape character before that.