https://kotlinlang.org logo
Title
j

juliocbcotta

08/08/2017, 8:41 PM
🤔 humm… looks interesting but I think it will not solve my problem… I need to validate stuff… like if the email EditText has a valid email and in case of error set the error in the TextInputLayout…
k

karelpeeters

08/08/2017, 8:45 PM
About that... Please leave your email validation at
email.contains('@')
, it's way to easy to get it wrong.
d

dragas

08/09/2017, 8:55 AM
or you could use:
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
as seen on emailregex.com