Permalink
Browse files

Merge pull request #315 from homakov/patch-1

Update lib/authlogic/regex.rb
  • Loading branch information...
2 parents b91683d + 6eb0cbe commit 256e8cf81ec5682ccddf98692851f2cf1a68259d @binarylogic committed Jun 1, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/authlogic/regex.rb
View
@@ -9,17 +9,18 @@ module Regex
# 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 = /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
+ @email_regex ||= begin
+ email_name_regex = '[A-Z0-9_\.%\+\-\']+'
+ domain_head_regex = '(?:[A-Z0-9\-]+\.)+'
+ domain_tld_regex = '(?:[A-Z]{2,4}|museum|travel)'
+ /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
+ end
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\.+\-_@ ]+$/
+ /\A\w[\w\.+\-_@ ]+\z/
end
end
end

0 comments on commit 256e8cf

Please sign in to comment.