2021年4月4日星期日

Validate only specific email domain using Regex

I want my regex accept only email domain like this: .com .co.id com.sg com.au

I tried create regex like this: ^[a-zA-Z0-9]+(?:[.\-_]{1}[a-zA-Z0-9]+)*@(?:[a-zA-Z0-9]+[\-])?(?:[a-zA-Z0-9]+\.)(?:(?:[a-zA-Z]{2,3}\.){1})?[a-zA-Z]{2,3}$

but it accept domain .com.com

https://stackoverflow.com/questions/66947800/validate-only-specific-email-domain-using-regex April 05, 2021 at 11:06AM

没有评论:

发表评论