Module: Authlogic::Regex
- Defined in:
- lib/authlogic/regex.rb
Overview
Class Method Summary collapse
-
.email ⇒ Object
A general email regular expression.
-
.login ⇒ Object
A simple regular expression that only allows for letters, numbers, spaces, and .-_@.
Class Method Details
.email ⇒ Object
A general email regular expression. It allows top level domains (TLD) to be from 2 - 13 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.
12 13 14 15 16 17 18 19 |
# File 'lib/authlogic/regex.rb', line 12 def self.email @email_regex ||= begin email_name_regex = '[A-Z0-9_\.%\+\-\']+' domain_head_regex = '(?:[A-Z0-9\-]+\.)+' domain_tld_regex = '(?:[A-Z]{2,13})' /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i end end |
.login ⇒ Object
A simple regular expression that only allows for letters, numbers, spaces, and .-_@. Just a standard login / username regular expression.
23 24 25 |
# File 'lib/authlogic/regex.rb', line 23 def self.login /\A\w[\w\.+\-_@ ]+\z/ end |