Module: EmailFormatValidator::Patterns

Defined in:
lib/email_format_validator.rb

Constant Summary collapse

ATOM =
create_regexp "[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+"
QTEXT =
create_regexp "[^\\x0d\\x22\\x5c\\x80-\\xff]"
QPAIR =
create_regexp "\\x5c[\\x00-\\x7f]"
QSTRING =
create_regexp "\\x22(?:#{QTEXT}|#{QPAIR})*\\x22"
WORD =
create_regexp "(?:#{ATOM}|#{QSTRING})"
LOCAL_PT =
create_regexp "#{WORD}(?:\\x2e#{WORD})*"
ADDRESS =
create_regexp "#{LOCAL_PT}\\x40#{URI::REGEXP::PATTERN::HOSTNAME}"
EMAIL =
/\A#{ADDRESS}\z/
LESS_RFC_COMPLIANT_EMAIL =
/\A[\w\-_\.]+@((?:[\w\-\.]+\.)+[a-z]{2,})\Z/i

Class Method Summary collapse

Class Method Details

.create_regexp(string) ⇒ Object



8
9
10
# File 'lib/email_format_validator.rb', line 8

def self.create_regexp(string)
  Regexp.new string, nil, 'n'
end