How can I restrict only numerics in the Email address. I tried below and it didn't work. My email should accept Alpha-numerics, dot, hyphen and underscore followed by "@AnyDomain.com". But it should not accept only numerics like "112233@gmail.com"
Pattern regexPattern = Pattern.compile("^[(a-zA-Z0-9-\\_\\.!\\D)]+@[(a-zA-Z)]+\\.[(a-zA-Z)]{2,3}$");
Matcher regmatcher = regexPattern.matcher(email);
- Don_123@gmail.com -> Valid
- 12345@gmail.com -> Invalid