, , , :
, test@ext.domain.com.mx domain.com.mx
, :
[^.@]*?\.\w{2,}$|[^.@]*?\.com?\.\w{2}$
regex101 : https://regex101.com/r/vE8rP9/59
You can get the name sumdomain (without a top-level domain, for example: .comor .com.mx) by adding search operators (but it will match twice in test@test.com.mx):
[^.@]*?(?=\.\w{2,}$)|[^.@]*?(?=\.com?\.\w{2}$)
Roddo source
share