Disini adalah android.util.Patterns.EMAIL_ADDRESS
[a-zA-Z0-9 + ._ \% - +] {1,256} \ @ [a-zA-Z0-9] [a-zA-Z0-9 -] {0,64} (. [a- zA-Z0-9] [a-zA-Z0-9 -] {0,25}) +
String
akan cocok jika
Start by 1->256 character in (a-z, A-Z, 0-9, +, ., _, %, - , +)
then 1 '@' character
then 1 character in (a-z, A-Z, 0-9)
then 0->64 character in (a-z, A-Z, 0-9, -)
then **ONE OR MORE**
1 '.' character
then 1 character in (a-z, A-Z, 0-9)
then 0->25 character in (a-z, A-Z, 0-9, -)
Contoh beberapa email pertandingan khusus
a@b.c
a+@b-.c
a@b.c.d.e.f.g.h
Anda dapat mengubah pola ini untuk kasus Anda kemudian divalidasi oleh
fun isValidEmail(email: String): Boolean {
return Patterns.EMAIL_ADDRESS.matcher(email).matches()
}