Sha256: 00a2e5e50677998c34c840941891cacbbf1232d8f65ec4cd83887b7336c3fb99

Contents?: true

Size: 1.75 KB

Versions: 27

Compression:

Stored size: 1.75 KB

Contents

# require "eitil_store/regex/regex"

module EitilStore
  module Regex

    # URL
    Url = /(\A\z)|(\A(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?\z)/ix

    # Domain
    Domain = /(\A\z)|(\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?)?\z)/ix

    # From the email regex research: http://fightingforalostcause.net/misc/2006/compare-email-regex.php
    Email = /\A([\w\!\#\z\%\&\'\*\+\-\/\=\?\\A\`{\|\}\~]+\.)*[\w\+-]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)\z/i

    # Validates a UUID as defined: http://en.wikipedia.org/wiki/Universally_unique_identifier
    UUID = /\A(\h{32}|\h{8}-\h{4}-\h{4}-\h{4}-\h{12})\z/

    # IsNum comes from the Rubinius source code and identifies both integers and floats correctly.
    IsNum = /^\s*[+-]?((\d+_?)*\d+(\.(\d+_?)*\d+)?|\.(\d+_?)*\d+)(\s*|([eE][+-]?(\d+_?)*\d+)\s*)$/

    # Validates Credit Card numbers, Checks if it contains 16 numbers in groups of 4 separated by -, space or nothing
    CreditCard = /\A(\d{4}-){3}\d{4}\z|\A(\d{4}\s){3}\d{4}\z|\A\d{16}\z/

    # MasterCard credit card
    MasterCard = /\A5[1-5]\d{14}\z/

    # Visa credit card
    Visa = /\A4\d{15}\z/

    # Source: http://snipplr.com/view/15322/iban-regex-all-ibans/
    # You have to remove spaces or any separator character from the original field before use this regex
    Iban = /[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}/

    # General postal code: validates a 5 digits postal code
    GeneralPostalCode = /\A\d{5}\z/

    # Validates US ZIP Code (basic and extended format)
    ZIPCode = /\A(\d{5}\z)|(\d{5}-\d{4}\z)/

    # LeadingBase64Data, e.g. "data:image/jpeg;base64,"
    LeadingBase64Data = /^data:image\/[a-z]+;base64,/

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
eitil-1.1.34 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.33 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.32 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.31 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.30 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.29 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.28 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.27 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.26 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.25 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.24 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.23 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.22 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.21 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.20 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.19 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.18 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.17 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.16 eitil_store/lib/eitil_store/regex/regex.rb
eitil-1.1.15 eitil_store/lib/eitil_store/regex/regex.rb