Module: Authlogic::Regex
- Defined in:
- lib/authlogic/regex.rb
Overview
Constant Summary collapse
- EMAIL =
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.
/ \A [A-Z0-9_.&%+\-']+ # mailbox @ (?:[A-Z0-9\-]+\.)+ # subdomains (?:[A-Z]{2,25}) # TLD \z /ix
- 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
-
/ \A [^[:cntrl:][@\[\]\^ \!"\#$\(\)*,\/:;<=>?`{|}~\\]]+ # mailbox @ (?:[^[:cntrl:][@\[\]\^ \!\"\#$&\(\)*,\/:;<=>\?`{|}~\\_.%+']]+\.)+ # subdomains (?:[^[:cntrl:][@\[\]\^ \!\"\#$&\(\)*,\/:;<=>\?`{|}~\\_.%+\-'0-9]]{2,25}) # TLD \z /x
- LOGIN =
A simple regular expression that only allows for letters, numbers, spaces, and .-_@+. Just a standard login / username regular expression.
/\A[a-zA-Z0-9_][a-zA-Z0-9\.+\-_@ ]+\z/
Class Method Summary collapse
- .email ⇒ Object deprecated Deprecated.
- .email_nonascii ⇒ Object deprecated Deprecated.
- .login ⇒ Object deprecated Deprecated.
Class Method Details
.email ⇒ Object
53 54 55 56 57 58 59 |
# 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 |
.email_nonascii ⇒ Object
62 63 64 65 66 67 68 |
# 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 |
.login ⇒ Object
71 72 73 74 75 76 77 |
# 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 |