<How to create Regex for mail id [duplicate]> I ha...
# stackoverflow
u
How to create Regex for mail id [duplicate] I have a requirement to validate mail id. Regex should follow all mail id validation and also follow less then 2 dot after @. I check lots of regex but not find correct one. I try below rex but it support lots of dot after @ fun isValid(email: String?): Boolean { val EMAIL_PATTERN = "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[^.]+(.[^.]+){0,1}$"; val pattern: Pattern = Pattern.compile(EMAIL_PATTERN) val matcher: Matcher = pattern.matcher(email)...