module Authlogic::Regex
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
Constants
A general email regular expression. It allows top level domains (TLD) to be from 2 - 24 in length. The decisions behind this regular expression were made by analyzing the list of top-level domains maintained by IANA and by reading this website: www.regular-expressions.info/email.html, which is an excellent resource for regular expressions.
- EMAIL_NONASCII
A draft regular expression for internationalized email addresses. Given that the standard may be in flux, this simply emulates @email_regex but rather than allowing specific characters for each part, it instead disallows the complement set of characters:
-
email_name_regex disallows: @[]^ !“#$()*,/:;<=>?`{|}~\ and control characters
-
domain_head_regex disallows: _%+ and all characters in email_name_regex
-
domain_tld_regex disallows: 0123456789- and all characters in domain_head_regex
en.wikipedia.org/wiki/Email_address#Internationalization tools.ietf.org/html/rfc6530 www.unicode.org/faq/idn.html ruby-doc.org/core-2.1.5/Regexp.html#class-Regexp-label-Character+Classes en.wikipedia.org/wiki/Unicode_character_property#General_Category
-
- LOGIN
A simple regular expression that only allows for letters, numbers, spaces, and .-_@+. Just a standard login / username regular expression.
Public Class Methods
@deprecated
# File lib/authlogic/regex.rb, line 53 def self.email ::ActiveSupport::Deprecation.warn( "Authlogic::Regex.email is deprecated, use Authlogic::Regex::EMAIL", caller(1) ) EMAIL end
@deprecated
# File lib/authlogic/regex.rb, line 62 def self.email_nonascii ::ActiveSupport::Deprecation.warn( "Authlogic::Regex.email_nonascii is deprecated, use Authlogic::Regex::EMAIL_NONASCII", caller(1) ) EMAIL_NONASCII end
@deprecated
# File lib/authlogic/regex.rb, line 71 def self.login ::ActiveSupport::Deprecation.warn( "Authlogic::Regex.login is deprecated, use Authlogic::Regex::LOGIN", caller(1) ) LOGIN end