Can someone please suggest me the regex for email ...
# javascript
k
Can someone please suggest me the regex for email address according to below image?
j
What does this have to do with Kotlin? Seems like a question you can ask on StackOverflow or perhaps consider following some tutorials on learning regex which should cover fixed-length sections.
2
k
Sure 👍
v
But it is
.{1,64}@.{1,255}
j
Please email me at @@@
v
Yes, that matches the given restrictions. At most 64 chars before the @ and at most 255 chars after the @
k
Actually I am not sure that how to fix the email regex part because I saw/check SO and I found so many different things and that is the reason I post the question here.
v
Properly validating a full E-Mail address is a very complex thing. Even
root
is a valid E-Mail address with which you can send e-mail to the user
root
on the local system. Properly validating an E-Mail address fully according to RFC is almost impossible, or at least not worth the effort. Better use some library that can parse E-Mails and tell you whether it is valid.
2
Or restrict yourself to some sub-format that you deem as valid
k
Sure thanks 😊