Sha256: 4697aee2dcfc4765df00db062f7ddf87561a0e72e746d2f38373bcd181b9f405

Contents?: true

Size: 1.04 KB

Versions: 59

Compression:

Stored size: 1.04 KB

Contents

# RFC822 Email Address Regex
# --------------------------
# 
# Originally written by Cal Henderson
# c.f. http://iamcal.com/publish/articles/php/parsing_email/
#
# Translated to Ruby by Tim Fletcher, with changes suggested by Dan Kubb.
#
# Licensed under a Creative Commons Attribution-ShareAlike 2.5 License
# http://creativecommons.org/licenses/by-sa/2.5/
# 
module RFC822
  RFC822_valid = begin
    qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'
    dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'
    atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-' +
      '\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'
    quoted_pair = '\\x5c[\\x00-\\x7f]'
    domain_literal = "\\x5b(?:#{dtext}|#{quoted_pair})*\\x5d"
    quoted_string = "\\x22(?:#{qtext}|#{quoted_pair})*\\x22"
    domain_ref = atom
    sub_domain = "(?:#{domain_ref}|#{domain_literal})"
    word = "(?:#{atom}|#{quoted_string})"
    domain = "#{sub_domain}(?:\\x2e#{sub_domain})*"
    local_part = "#{word}(?:\\x2e#{word})*"
    addr_spec = "#{local_part}\\x40#{domain}"
    pattern = /\A#{addr_spec}\z/
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
radiant-reader-extension-3.0.38 lib/rfc822.rb
radiant-reader-extension-3.0.37 lib/rfc822.rb
radiant-reader-extension-3.0.36 lib/rfc822.rb
radiant-reader-extension-3.0.35 lib/rfc822.rb
radiant-reader-extension-3.0.33 lib/rfc822.rb
radiant-reader-extension-3.0.32 lib/rfc822.rb
radiant-reader-extension-3.0.31 lib/rfc822.rb
radiant-reader-extension-3.0.30 lib/rfc822.rb
radiant-reader-extension-3.0.29 lib/rfc822.rb
radiant-reader-extension-3.0.28 lib/rfc822.rb
radiant-reader-extension-3.0.27 lib/rfc822.rb
radiant-reader-extension-3.0.26 lib/rfc822.rb
radiant-reader-extension-3.0.25 lib/rfc822.rb
radiant-reader-extension-3.0.24 lib/rfc822.rb
radiant-reader-extension-3.0.23 lib/rfc822.rb
radiant-reader-extension-3.0.20 lib/rfc822.rb
radiant-reader-extension-3.0.19 lib/rfc822.rb
radiant-reader-extension-3.0.18 lib/rfc822.rb
radiant-reader-extension-3.0.17 lib/rfc822.rb
radiant-reader-extension-3.0.16 lib/rfc822.rb