wmoxam/phonie

Data Split & Organize & Memoize

nofxx opened this issue · 0 comments

Up to discussion, but if each country code had it N.yml file?
It may get loaded in a JIT fashion, so country would load to memory only codes used.
And on each yml you could add comments that would really help figuring out the regexes.

How it would look for 55, Brazil:

# This file should be named 55.yml
# Local numbers start with 2 up to 9.
# Tool free start with 800
55:
  iso_code: BR
  national_dialing_prefix: '0'
  international_dialing_prefix: '00'
  area_code: ((1[1-9]|2[147]|3[1-578]|4[1-9]|5[1-5]|6[1235-9]|7[134579]|8[1-8]|9[12568])|0[3589]00)
  local_number_format: ([1-5]\d{7}|9?[6-9]\d{7}|\d{7})
  mobile_format: ([129][1-9]9|[3-9][1-9])[6-9]\d{7}
  number_format: \d{10,11}