I have a regular expression to check a string as email format as below:
Pattern p = Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@ + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
the correct email format is xxx.xxx@xxx.com
but sometimes my users complain they can't send email from the application due to invalid email format.
When using Matcher m = p.matcher(email);
, how can I find out which word/char does not match against the regular expression?