I am trying to validate email in Java Spring boot dto. This regex works fine for me, but in sonarqube I'm getting this warning/error "refactor this repetition that can lead to a stack overflow for large inputs".
private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)@" + "[A-Za-z0-9-]+(\.[A-Za-z0-9]+)(\.[A-Za-z]{2,})$";
Can someone shorten the regex or provide me better solution to avoid this type of warning for my regex in sonarqube ? I'm attaching the screenshot of warning :