Module: OcrChallenge::BasicTenDigitTelecomParser

Included in:
BasicLandAndCellNumberParser
Defined in:
lib/ocr_challenge/basic_ten_digit_telecom_parser.rb

Overview

This will find numbers that are grouped in 3 chunks of consecutive numbers, with chunk sizes of 3, 3, and 4 respectively, regardless of what is in between the chunks. It will also accept a leading 1. An example is 1-(234) 435-3567

Constant Summary collapse

BASIC_NUMBER_REGEX =
/([1][^\d]*)?[\d]{3}[^\d]*[\d]{3}[^\d]*[\d]{4}/

Instance Method Summary collapse

Instance Method Details

#get_matchesObject



9
10
11
12
13
# File 'lib/ocr_challenge/basic_ten_digit_telecom_parser.rb', line 9

def get_matches
  lines.select do |line|
    line =~ BASIC_NUMBER_REGEX
  end
end