sidx8 / validator_regex

Validator is a Dart package that provides simple and convenient methods to validate common input data such as emails, URLs, and IP addresses. This package can be particularly useful in situations where you need to validate user input in your Flutter application.
https://pub.dev/packages/validator_regex
MIT License
2 stars 0 forks source link

your email regex is WRONG #1

Open RandalSchwartz opened 1 year ago

RandalSchwartz commented 1 year ago
        r'^[a-zA-Z0-9.a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9]+\.[a-zA-Z0-9.]{2,}$';

No, please don't use this regex to validate email. It's wrong. The shortest regex to validate an RFC822 email address is about 2400 characters, and is given in https://www.ex-parrot.com/pdw/Mail-RFC822-Address.html. Anything shorter is WRONG, unless you're using a grammar, as package:email_validator properly does. Use that for Dart/Flutter please.

sidx8 commented 1 year ago

Hello, Thank you for pointing out the issue with the regex for email validation. I appreciate the link and the suggestion to use a more comprehensive solution. I understand the intricacies and nuances of email validation and the importance of adhering to the RFC822 standard. I'll definitely take a closer look