Sha256: abaf67ee9f3a65157d131a2b960f61763db1abe6f13f5b69435f415063c66f53

Contents?: true

Size: 336 Bytes

Versions: 2

Compression:

Stored size: 336 Bytes

Contents

module ValidatesTelephone
  module Regex
    def self.br(number)
      number =~ /^(\(?\d{2}\)?)(\d{4})-?(\d{4})$/
    end

    def self.usa(number)
      number =~ /^(\(?[^2-9]\d{2}\)?)(\d{3})-?(\d{4})$/
    end

    def self.any(number)
      number =~ /^(\(\d{2}\))(\d{4})-(\d{4})|(\([^2-9]\d{2}\))(\d{3})-(\d{4})$/
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validates_telephone-1.0.1 lib/validates_telephone/regex.rb
validates_telephone-1.0.0 lib/validates_telephone/regex.rb