Sha256: c69d6eb92bd8744df998d12791802267caeda1edf017511e9bf61284c0a7c33e

Contents?: true

Size: 586 Bytes

Versions: 2

Compression:

Stored size: 586 Bytes

Contents

module Dialable
  module Patterns

    # Regexs to match valid phone numbers
    NANP = [
      Regexp.new('^\D*1?\D*([2-9]\d\d)\D*(\d{3})\D*(\d{4})\D*[ex]+\D*(\d{1,5})\D*$', Regexp::IGNORECASE),
      Regexp.new('^\D*1?\D*([2-9]\d\d)[ $\\\.-]*(\d{3})[ $\\\.-]*(\d{4})[ $\\\.\*-]*(\d{1,5})\D*$', Regexp::IGNORECASE),
      Regexp.new('^\D*1?\D*([2-9]\d\d)\D*(\d{3})\D*(\d{4})\D*$'),
      Regexp.new('^(\D*)(\d{3})\D*(\d{4})\D*$'),
      Regexp.new('^\D*([2-9]11)\D*$'),
      Regexp.new('^\D*1?\D*([2-9]\d\d)\D*(\d{3})\D*(\d{4})\D.*') # Last ditch, just find a number
    ]

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dialable-1.0.2 lib/dialable/patterns.rb
dialable-1.0.0 lib/dialable/patterns.rb