module CustomEmailValidator

Public Class Methods

domain_head_regex() click to toggle source
# File lib/useful_validators/custom_email_validator.rb, line 12
def domain_head_regex
  '(?:[A-Z0-9\-]+\.)+'.freeze
end
domain_tld_regex() click to toggle source
# File lib/useful_validators/custom_email_validator.rb, line 16
def domain_tld_regex
  '(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'.freeze
end
email_name_regex() click to toggle source
# File lib/useful_validators/custom_email_validator.rb, line 8
def email_name_regex
  '[\w\.%\+\-]+'.freeze
end
email_regex() click to toggle source
# File lib/useful_validators/custom_email_validator.rb, line 4
def email_regex
  /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
end