Sha256: 092e7b57f9d383d7074ca2f94d1a69e6ae20440400341f1340b01c626b226fb4

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

module Authlogic
  # This is a module the contains regular expressions used throughout Authlogic. The point of extracting
  # them out into their own module is to make them easily available to you for other uses. Ex:
  #
  #   validates_format_of :my_email_field, :with => Authlogic::Regex.email
  module Regex
    # A general email regular expression. It allows top level domains (TLD) to be from 2 - 4 in length, any
    # TLD longer than that must be manually specified. The decisions behind this regular expression were made
    # by reading this website: http://www.regular-expressions.info/email.html, which is an excellent resource
    # for regular expressions.
    def self.email
      return @email_regex if @email_regex
      email_name_regex  = '[A-Z0-9_\.%\+\-]+'
      domain_head_regex = '(?:[A-Z0-9\-]+\.)+'
      domain_tld_regex  = '(?:[A-Z]{2,4}|museum|travel)'
      @email_regex = /^#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}$/i
    end

    # A simple regular expression that only allows for letters, numbers, spaces, and .-_@. Just a standard login / username
    # regular expression.
    def self.login
      /\A\w[\w\.+\-_@ ]+$/
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
refinerycms-0.9.6.34 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.33 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.32 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.31 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.30 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.29 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.28 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.27 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.26 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.25 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.24 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.23 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.22 vendor/plugins/authlogic/lib/authlogic/regex.rb
refinerycms-0.9.6.21 vendor/plugins/authlogic/lib/authlogic/regex.rb