Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leverage validators package instead of writing our own regexp #26

Open
tlvenn opened this issue Apr 9, 2021 · 4 comments
Open

Leverage validators package instead of writing our own regexp #26

tlvenn opened this issue Apr 9, 2021 · 4 comments

Comments

@tlvenn
Copy link

tlvenn commented Apr 9, 2021

Validation of common idioms via regexp is a tricky business and not something you really want to do yourself. For example, the regexp currently being used to validate emails is actually quite simple:

image

If we were to compare it to the one being define in the validators package:

image

Obviously the latter take into account Unicode characters and probably some other quirks.
I believe it would be better to simply leverage the validators package instead of trying to come up with regexps on our own that we have to maintain and test.

@tlvenn
Copy link
Author

tlvenn commented Apr 10, 2021

@themisir what do you think ? I can open a PR if there is an agreement that is probably a safer path forward.

@themisir
Copy link
Owner

I don't like depending on 3rd party packages just for a few lines of code actually 😅

@tlvenn
Copy link
Author

tlvenn commented Apr 11, 2021

I understand the sentiment but those few lines of codes are kinda critical to get right and duplicating and maintaining that effort seems kinda pointless. For me this falls into the same realm as Don't roll your own crypto. The above package has zero dependencies, do only 1 thing and seems to do it right and is well maintained as far as I can see.

@tlvenn
Copy link
Author

tlvenn commented Sep 8, 2022

For reference this package seems like an even better candidate, focusing only on email validation without using regexp

https://github.com/fredeil/email-validator.dart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants