lib/phonelib/phone_analyzer.rb in phonelib-0.4.4 vs lib/phonelib/phone_analyzer.rb in phonelib-0.4.5

- old
+ new

@@ -190,11 +190,11 @@ # * +national+ - national phone number # * +format_data+ - formatting data from country data def get_number_format(national, format_data) format_data && format_data.find do |format| (format[Core::LEADING_DIGITS].nil? \ - || /^#{format[Core::LEADING_DIGITS]}/ =~ national) \ - && /^#{format[Core::PATTERN]}$/ =~ national + || /^(#{format[Core::LEADING_DIGITS]})/ =~ national) \ + && /^(#{format[Core::PATTERN]})$/ =~ national end || Core::DEFAULT_NUMBER_FORMAT end # Checks if fixed line pattern and mobile pattern are the same and returns # appropriate keys