-
Notifications
You must be signed in to change notification settings - Fork 25
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
CPF without special characters #5
Comments
Hey! Thank you for taking your time checking out this project! Even though, I don't think that is, currently, a problem. About your tip: I didn't want to clean it because that would prevent the code to validate invalid special characters (actually, that was the old solution). Those documents have a specific mask/format, and that should be validated too, not just the numbers. For example, and ignoring the consistency of the numbers here, There is still room for improvement. The current solution checks every special char individually, which can lead to return something like a I'll let this issue open for awhile if there's anything more you'd like to discuss! ;) |
Awesome, you're right, I didn't notice the About your specific case |
That is a solution! I'll think about implementing it. |
Maybe a mismatch, if someone input "24843803480" like in your documentation (at README.md), it couldn't be valid, cause you are matching with a regex with special characters... and I saw that in your tests, you didn't test CPF like this.
one possible solution, you could clean all special characters before everything and match with length 11 (regex like
^\d{11}$
or justlen(doc) == 11
)https://github.com/Nhanderu/brdoc/blob/8e80a668ca902bcc443abacacbacbd47c3503674/cpfcnpj.go#L45
The text was updated successfully, but these errors were encountered: