Validation - library with +25 fully tested rules. +40 coming up soon!

Hey dear #AlchemistFriends! I’m creating a :heavy_check_mark::heavy_check_mark: validation engine :heavy_check_mark::heavy_check_mark:, in order to put several day-to-day validation rules all together!!!
If you folks could take a look real quick and provide me some feedback, that would be just fantastic to listen from you :+1::+1::+1:

Some validation rules for instance: Email, Credit Card, Barcode, IBAN, WordCount, PostalCode (us, uk, br…), CountryCode, MacAddress… and +65 other ;- )

P.S.: I’m very-very-very new to the Elixir ecosystem. Literally just 2 weeks learning the language & writing code. Please :pray::pray: be a bit merciful (hehe). Thanks for your understanding.

5 Likes

Just to point out, while it is deprecated it is perfectly valid email:

foo(@)@baz.com

And I believe your regex will mark it as invalid. You have 2 options how to approach such data as this one:

  • Strictly follow RFC2822 (but for example use flags to disallow some features like comments)
  • Use HTML5 default regex, which is not correct, but at least it will match the same expectations as browser does

Otherwise it ends somewhere in between and can be a little bit confusing (ignoring fact that such long regex is very easy to abuse and force engine to do matching in O(n^2)).

EDIT:

Also it is hard to tell in your alphanumeric/alpha/etc. work within Unicode groups or not. Is string ٠ numeric or not? This character is U+0660 Arabic-Indic Digit Zero, so it is digit, but I think that You do not expected that.

4 Likes