View Source Veli.Validators.Format (Veli v0.2.6)

String format validator.

note

Note

Most of the format validation are done by using regex. Most of them are -> https://ihateregex.io/ <- taken from here.

atoms

Atoms

  • :email: Email adress
  • :url: Url
  • :slug: Slug
  • :ipv4: IPv4
  • :ipv6: IPv6
  • :ip: both IPv4, IPv6
  • :ascii: ASCII
  • :printable: Printable ASCII
  • :uuid: UUID
  • :mac: MAC Adress
  • :username: Username
  • :cc: Credit Card
  • :e164: e.164 Phone Number Format
  • :btcaddr: Bitcoin Adress
  • :semver: Semantic Versioning

example

Example

rule = [type: :string, format: :url]
Veli.valid("hello", rule) # not valid
Veli.valid("https://x.org/", rule) # valid

Link to this section Summary

Link to this section Functions

@spec valid?(binary(), boolean()) :: boolean()