lib/telephone_number/parser.rb in telephone_number-1.4.0 vs lib/telephone_number/parser.rb in telephone_number-1.4.1
- old
+ new
@@ -36,10 +36,10 @@
end
def parse_prefix
return original_number unless country.national_prefix_for_parsing
duped = original_number.dup
- match_object = duped.match(country.national_prefix_for_parsing)
+ match_object = duped.match("^(?:#{country.national_prefix_for_parsing})")
# we need to do the "start_with?" here because we need to make sure it's not finding
# something in the middle of the number. However, we can't modify the regex to do this
# for us because it will offset the match groups that are referenced in the transform rules
return original_number unless match_object && duped.start_with?(match_object[0])