phony 2.20.12 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +117 -0
  3. data/lib/phony/config.rb +25 -26
  4. data/lib/phony/countries/argentina.rb +311 -314
  5. data/lib/phony/countries/austria.rb +71 -72
  6. data/lib/phony/countries/bangladesh.rb +27 -28
  7. data/lib/phony/countries/belarus.rb +110 -111
  8. data/lib/phony/countries/brazil.rb +92 -92
  9. data/lib/phony/countries/cambodia.rb +9 -9
  10. data/lib/phony/countries/china.rb +22 -21
  11. data/lib/phony/countries/croatia.rb +6 -5
  12. data/lib/phony/countries/georgia.rb +84 -84
  13. data/lib/phony/countries/germany.rb +4067 -4068
  14. data/lib/phony/countries/guinea.rb +8 -8
  15. data/lib/phony/countries/india.rb +31 -34
  16. data/lib/phony/countries/indonesia.rb +57 -46
  17. data/lib/phony/countries/ireland.rb +4 -5
  18. data/lib/phony/countries/italy.rb +54 -53
  19. data/lib/phony/countries/japan.rb +456 -456
  20. data/lib/phony/countries/kyrgyzstan.rb +109 -109
  21. data/lib/phony/countries/latvia.rb +34 -34
  22. data/lib/phony/countries/libya.rb +109 -107
  23. data/lib/phony/countries/malaysia.rb +12 -12
  24. data/lib/phony/countries/moldova.rb +42 -42
  25. data/lib/phony/countries/montenegro.rb +24 -20
  26. data/lib/phony/countries/myanmar.rb +39 -39
  27. data/lib/phony/countries/namibia.rb +35 -29
  28. data/lib/phony/countries/nepal.rb +60 -62
  29. data/lib/phony/countries/netherlands.rb +13 -13
  30. data/lib/phony/countries/pakistan.rb +135 -111
  31. data/lib/phony/countries/paraguay.rb +135 -135
  32. data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
  33. data/lib/phony/countries/saudi_arabia.rb +5 -5
  34. data/lib/phony/countries/serbia.rb +47 -39
  35. data/lib/phony/countries/somalia.rb +18 -18
  36. data/lib/phony/countries/south_korea.rb +16 -13
  37. data/lib/phony/countries/sweden.rb +356 -48
  38. data/lib/phony/countries/taiwan.rb +20 -19
  39. data/lib/phony/countries/tajikistan.rb +70 -70
  40. data/lib/phony/countries/turkmenistan.rb +65 -65
  41. data/lib/phony/countries/ukraine.rb +607 -607
  42. data/lib/phony/countries/united_kingdom.rb +66 -66
  43. data/lib/phony/countries/uruguay.rb +40 -41
  44. data/lib/phony/countries/vietnam.rb +19 -17
  45. data/lib/phony/countries/zimbabwe.rb +31 -31
  46. data/lib/phony/countries.rb +473 -452
  47. data/lib/phony/country.rb +44 -44
  48. data/lib/phony/country_codes.rb +67 -60
  49. data/lib/phony/dsl.rb +23 -26
  50. data/lib/phony/local_splitters/fixed.rb +23 -30
  51. data/lib/phony/local_splitters/regex.rb +30 -31
  52. data/lib/phony/national_code.rb +7 -10
  53. data/lib/phony/national_splitters/default.rb +9 -11
  54. data/lib/phony/national_splitters/dsl.rb +8 -18
  55. data/lib/phony/national_splitters/fixed.rb +12 -15
  56. data/lib/phony/national_splitters/none.rb +7 -11
  57. data/lib/phony/national_splitters/regex.rb +13 -17
  58. data/lib/phony/national_splitters/variable.rb +37 -38
  59. data/lib/phony/trunk_code.rb +20 -20
  60. data/lib/phony/vanity.rb +12 -13
  61. data/lib/phony.rb +84 -84
  62. metadata +9 -42
  63. data/README.textile +0 -116
  64. data/spec/functional/config_spec.rb +0 -44
  65. data/spec/functional/plausibility_spec.rb +0 -688
  66. data/spec/lib/phony/countries_spec.rb +0 -1459
  67. data/spec/lib/phony/country_codes_spec.rb +0 -227
  68. data/spec/lib/phony/country_spec.rb +0 -104
  69. data/spec/lib/phony/dsl_spec.rb +0 -28
  70. data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
  71. data/spec/lib/phony/local_splitters/regex_spec.rb +0 -94
  72. data/spec/lib/phony/national_code_spec.rb +0 -61
  73. data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
  74. data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -45
  75. data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
  76. data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
  77. data/spec/lib/phony/national_splitters/variable_spec.rb +0 -35
  78. data/spec/lib/phony/trunk_code_spec.rb +0 -85
  79. data/spec/lib/phony/vanity_spec.rb +0 -30
  80. data/spec/lib/phony_spec.rb +0 -70
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  # All countries, ordered by country code.
@@ -44,7 +43,6 @@
44
43
  # )
45
44
  #
46
45
  Phony.define do
47
-
48
46
  # Reserved.
49
47
  #
50
48
  reserved '0'
@@ -52,16 +50,16 @@ Phony.define do
52
50
  # USA, Canada, etc.
53
51
  #
54
52
  country '1',
55
- # The US has a delimiter between NDC and local number.
56
- trunk('1%s', normalize: true, format: false) | # http://en.wikipedia.org/wiki/Trunk_prefix
57
- fixed(3) >> split(3,4),
58
- :invalid_ndcs => /[0-1]\d{2}|[3-9]11/,
59
- :parentheses => true,
60
- :local_space => :-
53
+ # The US has a delimiter between NDC and local number.
54
+ trunk('1%s', normalize: true, format: false) | # http://en.wikipedia.org/wiki/Trunk_prefix
55
+ fixed(3) >> split(3, 4),
56
+ invalid_ndcs: /[0-1]\d{2}|[3-9]11/,
57
+ parentheses: true,
58
+ local_space: :-
61
59
 
62
60
  # Kazakhstan (Republic of) & Russsian Federation.
63
61
  # also Abhasia and South Osetia autonomous regions / recognized by some states as independent countries
64
- #country '7', fixed(3) >> split(3,2,2)
62
+ # country '7', fixed(3) >> split(3,2,2)
65
63
  # see special file
66
64
 
67
65
  # Egypt.
@@ -70,26 +68,26 @@ Phony.define do
70
68
  one_of('3') >> split(7..7) | # Alexandria
71
69
  one_of('2') >> split(8..8) | # Cairo/Giza
72
70
  one_of('10', '11', '12', '15') >> split(8..8) | # the 4 mobile operators
73
- fixed(2) >> split(7..7) # all the other 24 provinces
71
+ fixed(2) >> split(7..7) # all the other 24 provinces
74
72
 
75
73
  # South Africa.
76
74
  #
77
- country '27', fixed(2) >> split(3,4)
75
+ country '27', fixed(2) >> split(3, 4)
78
76
 
79
77
  # Greece. http://www.numberingplans.com/?page=dialling&sub=areacodes
80
78
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GR
81
79
  country '30',
82
- trunk('0') |
83
- one_of(%w(231 241 251 261 271 281)) >> split(3,4) |
84
- one_of('800') >> split(3,4) | # freephone
85
- one_of(%w(801 807)) >> split(3,4) | # shared cost, premium rate
86
- one_of('896') >> split(3,4) | # ISP
87
- one_of(%w(901 909)) >> split(3,4) | # premium rate
88
- one_of(%w(21 22 23 24 25 26 27 28)) >> split(4,4) |
89
- one_of('50') >> split(4,4) | # VPN
90
- match(/^(69\d)\d+$/) >> split(3,4) | # mobile, pager
91
- one_of('70') >> split(4,4) | # universal access
92
- fixed(4) >> split(6) # 3-digit NDCs
80
+ trunk('0') |
81
+ one_of(%w[231 241 251 261 271 281]) >> split(3, 4) |
82
+ one_of('800') >> split(3, 4) | # freephone
83
+ one_of(%w[801 807]) >> split(3, 4) | # shared cost, premium rate
84
+ one_of('896') >> split(3, 4) | # ISP
85
+ one_of(%w[901 909]) >> split(3, 4) | # premium rate
86
+ one_of(%w[21 22 23 24 25 26 27 28]) >> split(4, 4) |
87
+ one_of('50') >> split(4, 4) | # VPN
88
+ match(/^(69\d)\d+$/) >> split(3, 4) | # mobile, pager
89
+ one_of('70') >> split(4, 4) | # universal access
90
+ fixed(4) >> split(6) # 3-digit NDCs
93
91
 
94
92
  # country '31' # Netherlands, see special file.
95
93
 
@@ -99,46 +97,46 @@ Phony.define do
99
97
  # https://www.bipt.be/operators/publication/national-numbering-plan
100
98
  #
101
99
  country '32', trunk('0') |
102
- match(/^(7[08])\d+$/) >> split(3,3) | # Premium and national rate Services
103
- match(/^(800|90\d)\d+$/) >> split(2,3) | # Toll free service and premium numbers
104
- match(/^(46[056789])\d{6}$/) >> split(2,2,2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
105
- match(/^(4[789]\d)\d{6}$/) >> split(2,2,2) | # Mobile
106
- match(/^(45[56])\d{6}$/) >> split(2,2,2) | # Mobile Vikings and Voo
107
- one_of('2','3','4','9') >> split(3,2,2) | # Short NDCs
108
- fixed(2) >> split(2,2,2) # 2-digit NDCs
100
+ match(/^(7[08])\d+$/) >> split(3, 3) | # Premium and national rate Services
101
+ match(/^(800|90\d)\d+$/) >> split(2, 3) | # Toll free service and premium numbers
102
+ match(/^(46[056789])\d{6}$/) >> split(2, 2, 2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
103
+ match(/^(4[789]\d)\d{6}$/) >> split(2, 2, 2) | # Mobile
104
+ match(/^(45[156])\d{6}$/) >> split(2, 2, 2) | # Mobile Vikings, Digi and Voo
105
+ one_of('2', '3', '4', '9') >> split(3, 2, 2) | # Short NDCs
106
+ fixed(2) >> split(2, 2, 2) # 2-digit NDCs
109
107
 
110
108
  # France.
111
109
  #
112
110
  country '33',
113
- trunk('0') |
114
- fixed(1) >> split(2,2,2,2) # :service? => /^8.*$/, :mobile? => /^[67].*$/
111
+ trunk('0') |
112
+ fixed(1) >> split(2, 2, 2, 2) # :service? => /^8.*$/, :mobile? => /^[67].*$/
115
113
 
116
114
  # Spain.
117
115
  #
118
116
  # http://www.minetur.gob.es/telecomunicaciones/es-es/servicios/numeracion/paginas/plan.aspx
119
117
  #
120
118
  country '34',
121
- match(/^([67]\d{2})\d+$/) >> split(3,3) | # Mobile
122
- match(/^([89]0\d)\d+$/) >> split(3,3) | # Special 80X & 90X numbers
123
- one_of(%w(91 93)) >> split(3,2,2) | # Landline large regions
124
- match(/^(9\d{2})\d+$/) >> split(2,2,2) | # Landline
125
- fixed(3, :zero => false) >> split(3,3)
119
+ match(/^([67]\d{2})\d+$/) >> split(3, 3) | # Mobile
120
+ match(/^([89]0\d)\d+$/) >> split(3, 3) | # Special 80X & 90X numbers
121
+ one_of(%w[91 93]) >> split(3, 2, 2) | # Landline large regions
122
+ match(/^(9\d{2})\d+$/) >> split(2, 2, 2) | # Landline
123
+ fixed(3, zero: false) >> split(3, 3)
126
124
 
127
125
  # Hungary.
128
126
  #
129
127
  # http://webpub-ext.nmhh.hu/aga/foldr/DoIndexAction.do
130
128
  #
131
129
  country '36',
132
- trunk('06', normalize: false) |
133
- one_of('104', '105', '107', '112') >> split(3,3) | # Service
134
- one_of('1') >> split(3,4) | # Budapest
135
- one_of('20', '30', '31', '50', '70') >> split(3,4) | # Mobile
136
- one_of('21') >> split(3,4) | # VOIP
137
- one_of('40', '80', '90', '91') >> split(3,3) | # Special charged numbers
138
- one_of('51') >> split(3,3) | # Corporate network, M2M
139
- one_of('38') >> split(3,4) | # Corporate network, M2M
140
- one_of('71') >> split(5,5) | # M2M Numbers
141
- fixed(2) >> split(3,3) # Geographic numbers
130
+ trunk('06', normalize: false) |
131
+ one_of('104', '105', '107', '112') >> split(3, 3) | # Service
132
+ one_of('1') >> split(3, 4) | # Budapest
133
+ one_of('20', '30', '31', '50', '70') >> split(3, 4) | # Mobile
134
+ one_of('21') >> split(3, 4) | # VOIP
135
+ one_of('40', '80', '90', '91') >> split(3, 3) | # Special charged numbers
136
+ one_of('51') >> split(3, 3) | # Corporate network, M2M
137
+ one_of('38') >> split(3, 4) | # Corporate network, M2M
138
+ one_of('71') >> split(5, 5) | # M2M Numbers
139
+ fixed(2) >> split(3, 3) # Geographic numbers
142
140
 
143
141
  # country '39' # Italy, see special file.
144
142
 
@@ -146,19 +144,19 @@ Phony.define do
146
144
  #
147
145
  country '40',
148
146
  trunk('0') |
149
- match(/^(112|800|90[036])\d+$/) >> split(3,3) | # Service
150
- match(/^(7[1-9])\d+$/) >> split(3,4) | # Mobile
151
- one_of('21', '31') >> split(3,4) | # Bucureşti
152
- fixed(3) >> split(3,3) # 3-digit NDCs
147
+ match(/^(112|800|90[036])\d+$/) >> split(3, 3) | # Service
148
+ match(/^(7[1-9])\d+$/) >> split(3, 4) | # Mobile
149
+ one_of('21', '31') >> split(3, 4) | # Bucureşti
150
+ fixed(3) >> split(3, 3) # 3-digit NDCs
153
151
 
154
152
  # Switzerland.
155
153
  #
156
154
  country '41',
157
155
  trunk('0', normalize: true) |
158
156
  match(/^(860)\d+$/) >> split(2, 3, 2, 2) | # Voice Mail access
159
- match(/^(8(?:00|4[0248]))\d+$/) >> split(3,3) | # Freecall/Shared Cost
160
- match(/^(90[016])\d+$/) >> split(3,3) | # Business
161
- fixed(2) >> split(3,2,2)
157
+ match(/^(8(?:00|4[0248]))\d+$/) >> split(3, 3) | # Freecall/Shared Cost
158
+ match(/^(90[016])\d+$/) >> split(3, 3) | # Business
159
+ fixed(2) >> split(3, 2, 2)
162
160
 
163
161
  # country '43' # Austria, see special file.
164
162
  # country '44' # UnitedKingdom, see special file.
@@ -166,24 +164,24 @@ Phony.define do
166
164
  # Denmark.
167
165
  #
168
166
  country '45',
169
- none >> split(2,2,2,2..2)
167
+ none >> split(2, 2, 2, 2..2)
170
168
 
171
169
  # country '46' # Sweden, see special file.
172
170
 
173
171
  # Norway.
174
172
  #
175
173
  country '47',
176
- none >> matched_split(/^[1].*$/ => [3],
177
- /^[489].*$/ => [3,2,3],
178
- :fallback => [2,2,2,2])
174
+ none >> matched_split(/^[1].*$/ => [3],
175
+ /^[489].*$/ => [3, 2, 3],
176
+ :fallback => [2, 2, 2, 2])
179
177
 
180
178
  # Poland (Republic of)
181
179
  # Although the NDCs are 2 digits, the representation is 3 digits.
182
180
  # Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
183
181
  #
184
182
  country '48',
185
- match(/^(45\d|5[0137]\d|6[069]\d|7[02389]\d|80[01]|88\d)/) >> split(3,3) |
186
- fixed(2) >> split(3,2,2)
183
+ match(/^(45\d|5[0137]\d|6[069]\d|7[02389]\d|80[01]|88\d)/) >> split(3, 3) |
184
+ fixed(2) >> split(3, 2, 2)
187
185
 
188
186
  # country '49' # Germany, see special file.
189
187
 
@@ -191,21 +189,21 @@ Phony.define do
191
189
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Peru
192
190
  # Note: https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PE
193
191
  country '51',
194
- one_of('103', '105') >> split(3,3) | # Service.
195
- one_of('9') >> split(4,4) | # Mobile.
196
- one_of('1') >> split(3,4) | # Lima.
197
- fixed(2) >> split(3,3) # 2-digit NDCs.
192
+ one_of('103', '105') >> split(3, 3) | # Service.
193
+ one_of('9') >> split(4, 4) | # Mobile.
194
+ one_of('1') >> split(3, 4) | # Lima.
195
+ fixed(2) >> split(3, 3) # 2-digit NDCs.
198
196
 
199
197
  # Mexico.
200
198
  #
201
199
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Mexico
202
200
  # http://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Mexico
203
201
  country '52',
204
- match(/^(0\d{1,2})\d{10}$/) >> split(3,3,4) | # prefixed numbers from within Mexico (e.g. 045 + 10 digits or 02 + 10 digits)
205
- match(/^(1)(33|55|81)\d{8}$/) >> split(2,4,4) | # Mexico D.F, Guadalajara, Monterrey cell phone from abroad (e.g. 52 1 55 xxxx xxxx)
206
- match(/^(33|55|81)\d{8}$/) >> split(4,4) | # Mexico D.F, Guadalajara, Monterrey from within Mexico
207
- match(/^(1)(\d{3})\d{7}$/) >> split(3,3,4) | # cell phone from abroad
208
- match(/^(\d{3})\d{7}$/) >> split(3,4) # catchall.
202
+ match(/^(0\d{1,2})\d{10}$/) >> split(3, 3, 4) | # prefixed numbers from within Mexico (e.g. 045 + 10 digits or 02 + 10 digits)
203
+ match(/^(1)(33|55|81)\d{8}$/) >> split(2, 4, 4) | # Mexico D.F, Guadalajara, Monterrey cell phone from abroad (e.g. 52 1 55 xxxx xxxx)
204
+ match(/^(33|55|81)\d{8}$/) >> split(4, 4) | # Mexico D.F, Guadalajara, Monterrey from within Mexico
205
+ match(/^(1)(\d{3})\d{7}$/) >> split(3, 3, 4) | # cell phone from abroad
206
+ match(/^(\d{3})\d{7}$/) >> split(3, 4) # catchall.
209
207
 
210
208
  # Cuba.
211
209
  #
@@ -224,76 +222,82 @@ Phony.define do
224
222
  # Chile.
225
223
  #
226
224
  country '56',
227
- match(/^(13[0-79]|14[79])\d+$/) >> split(3,3) | # Service
228
- one_of('2', '9') >> split(8) | # Santiago, Mobile
229
- fixed(2) >> split(8) # 2-digit NDCs
225
+ match(/^(13[0-79]|14[79])\d+$/) >> split(3, 3) | # Service
226
+ one_of('2', '9') >> split(8) | # Santiago, Mobile
227
+ fixed(2) >> split(8) # 2-digit NDCs
230
228
 
231
229
  # Colombia.
232
230
  # http://www.itu.int/oth/T020200002C/en
233
231
  country '57',
234
- match(/\A(3\d\d)\d+\z/) >> split(3,4) | # mobile (300 310 311 312 313 315 316)
235
- match(/\A(60\d)\d+\z/) >> split(3,4) |
236
- fixed(1) >> split(3,4)
232
+ match(/\A(1800)\d+\z/) >> split(3, 4) | # toll free 1800 numbers
233
+ match(/\A(3\d\d)\d+\z/) >> split(3, 4) | # mobile (300 310 311 312 313 315 316)
234
+ match(/\A(60\d)\d+\z/) >> split(3, 4) |
235
+ fixed(1) >> split(3, 4)
237
236
 
238
237
  # Venezuela (Bolivarian Republic of)
239
238
  #
240
239
  country '58',
241
- fixed(3) >> split(7)
240
+ fixed(3) >> split(7)
242
241
 
243
242
  # country '60' # Malaysia, see special file.
244
243
 
245
244
  # Australia.
246
245
  #
247
246
  country '61',
248
- trunk('0', format: false) |
249
- match(/^(4\d\d)\d+$/) >> split(3,3) | # Mobile
250
- match(/^(1800)\d+$/) >> split(3,3) | # 1800 free call
251
- match(/^(1300)\d+$/) >> split(3,3) | # 1300 local rate
252
- match(/^(13)\d+$/) >> split(2,2) | # 13 local rate
253
- fixed(1) >> split(4,4) # Rest
247
+ trunk('0', format: false) |
248
+ match(/^(4\d\d)\d+$/) >> split(3, 3) | # Mobile
249
+ match(/^(1800)\d+$/) >> split(3, 3) | # 1800 free call
250
+ match(/^(1300)\d+$/) >> split(3, 3) | # 1300 local rate
251
+ match(/^(13)\d+$/) >> split(2, 2) | # 13 local rate
252
+ fixed(1) >> split(4, 4) # Rest
254
253
 
255
- # country '62' # Indonesia (Republic of), see special file
254
+ # country '62' # Indonesia (Republic of), see special file
256
255
 
257
256
  # Philippines (Republic of the)
258
257
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PH
259
258
  country '63',
260
- trunk('0') |
261
- # 7/10 digits for area code '2'.
262
- match(/\A(2)\d{10}\z/) >> split(10) |
263
- match(/\A(2)\d{8}\z/) >> split(8) |
264
- one_of('2') >> split(7) |
265
- # mobile
266
- match(/\A([89]\d\d)\d{7}\z/) >> split(7) |
267
- match(/\A(9\d\d)\d+\z/) >> split(6) |
268
- #
269
- fixed(2) >> split(7)
259
+ trunk('0') |
260
+ # 7/10 digits for area code '2'.
261
+ match(/\A(2)\d{10}\z/) >> split(10) |
262
+ match(/\A(2)\d{8}\z/) >> split(8) |
263
+ one_of('2') >> split(7) |
264
+ # mobile
265
+ match(/\A([89]\d\d)\d{7}\z/) >> split(7) |
266
+ match(/\A(9\d\d)\d+\z/) >> split(6) |
267
+ fixed(2) >> split(7)
270
268
 
271
269
  # New Zealand.
272
270
  #
273
271
  country '64',
274
- trunk('0') |
275
- match(/^(2\d)\d{7}$/) >> split(3,4) | # Mobile
276
- match(/^(2\d)\d{6}$/) >> split(3,3) |
277
- match(/^(2\d)\d{8}$/) >> split(2,3,3) |
278
- match(/^(800)\d{6}$/) >> split(3,3) | # International 800 service where agreed
279
- match(/^(800)\d{7}$/) >> split(3,4) | # International 800 service where agreed
280
- fixed(1) >> split(3,4) # Rest
272
+ trunk('0') |
273
+ match(/^(2\d)\d{7}$/) >> split(3, 4) | # Mobile
274
+ match(/^(2\d)\d{6}$/) >> split(3, 3) |
275
+ match(/^(2\d)\d{8}$/) >> split(2, 3, 3) |
276
+ match(/^(800)\d{6}$/) >> split(3, 3) | # International 800 service where agreed
277
+ match(/^(800)\d{7}$/) >> split(3, 4) | # International 800 service where agreed
278
+ match(/^(508)\d{6}$/) >> split(3, 3) | # Toll-free 0508
279
+ match(/^(508)\d{7}$/) >> split(3, 4) | # Toll-free 0508
280
+ match(/^(900)\d{5}$/) >> split(3, 2) | # Premium rate 0900
281
+ match(/^(900)\d{6}$/) >> split(3, 3) | # Premium rate 0900
282
+ fixed(1) >> split(3, 4) # Rest
281
283
 
282
284
  # Singapore (Republic of).
283
285
  #
286
+ # There is no trunk code for this country and some numbers start with 0.
284
287
  country '65',
285
- none >> matched_split(
286
- /^(800)\d{7}$/ => [3,3,4], # International Toll Free Service (ITFS) and Home Country Direct Service (HCDS) Numbers
287
- /^\d{8}$/ => [4,4] # TODO Short Codes
288
- )
288
+ trunk('', normalize: false) |
289
+ none >> matched_split(
290
+ /^(800)\d{7}$/ => [3, 3, 4], # International Toll Free Service (ITFS) and Home Country Direct Service (HCDS) Numbers
291
+ /^\d{8}$/ => [4, 4] # TODO: Short Codes
292
+ )
289
293
 
290
294
  # Thailand.
291
295
  #
292
296
  country '66',
293
- trunk('0') |
294
- match(/\A([689]\d\d)\d+\z/) >> split(3,3) | # mobile
295
- one_of('2') >> split(3,4) | # Bangkok
296
- fixed(2) >> split(3,3) # Rest
297
+ trunk('0') |
298
+ match(/\A([689]\d\d)\d+\z/) >> split(3, 3) | # mobile
299
+ one_of('2') >> split(3, 4) | # Bangkok
300
+ fixed(2) >> split(3, 3) # Rest
297
301
 
298
302
  # country '81' # Japan, see special file.
299
303
 
@@ -306,8 +310,8 @@ Phony.define do
306
310
  # Turkey.
307
311
  #
308
312
  country '90',
309
- trunk('0') |
310
- fixed(3) >> split(3,4) # Wiki says 7, but the examples say 3, 4.
313
+ trunk('0') |
314
+ fixed(3) >> split(3, 4) # Wiki says 7, but the examples say 3, 4.
311
315
 
312
316
  # country '91' # India (Republic of) see special file
313
317
 
@@ -317,39 +321,39 @@ Phony.define do
317
321
  #
318
322
  # From http://www.wtng.info/wtng-93-af.html
319
323
  #
320
- country '93', fixed(2) >> split(7) # Note: the document says 6, but the examples use 7.
324
+ country '93', fixed(2) >> split(7) # NOTE: the document says 6, but the examples use 7.
321
325
 
322
- country '94', # TODO Sri Lanka (Democratic Socialist Republic of)
323
- fixed(2) >> split(3,2,2)
326
+ country '94', # TODO: Sri Lanka (Democratic Socialist Republic of)
327
+ fixed(2) >> split(3, 2, 2)
324
328
 
325
- #country '95' # Myanmar, see special file.
329
+ # country '95' # Myanmar, see special file.
326
330
 
327
331
  country '98', # Iran (Islamic Republic of)
328
- one_of('21') >> split(4,4) | # Teheran
329
- fixed(3) >> split(3,4)
332
+ one_of('21') >> split(4, 4) | # Teheran
333
+ fixed(3) >> split(3, 4)
330
334
 
331
335
  country '210', todo # -
332
- country '211', fixed(3) >> split(3,3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
336
+ country '211', fixed(3) >> split(3, 3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
333
337
 
334
338
  country '212', # Morocco
335
- trunk('0') |
336
- one_of('6') >> split(2,2,2,2) | # mobile
337
- fixed(2) >> split(4,3)
339
+ trunk('0') |
340
+ one_of('6') >> split(2, 2, 2, 2) | # mobile
341
+ fixed(2) >> split(4, 3)
338
342
 
339
- country '213', fixed(2) >> split(3,4) # Algeria
343
+ country '213', fixed(2) >> split(3, 4) # Algeria
340
344
  country '214', todo # -
341
345
  country '215', todo # -
342
- country '216', fixed(1) >> split(3,4) # Tunisia
346
+ country '216', fixed(1) >> split(3, 4) # Tunisia
343
347
  country '217', todo # -
344
348
 
345
349
  # country '218' # Lybia, see special file
346
350
 
347
351
  country '219', todo # -
348
352
 
349
- country '220', none >> split(3,4) # Gambia http://www.wtng.info/wtng-220-gm.html
350
- country '221', none >> split(4,5) # Senegal http://www.wtng.info/wtng-221-sn.html
351
- country '222', none >> split(4,4) # Mauritania http://www.wtng.info/wtng-222-mr.html
352
- country '223', none >> split(4,4) # Mali http://www.wtng.info/wtng-223-ml.html
353
+ country '220', none >> split(3, 4) # Gambia http://www.wtng.info/wtng-220-gm.html
354
+ country '221', none >> split(4, 5) # Senegal http://www.wtng.info/wtng-221-sn.html
355
+ country '222', none >> split(4, 4) # Mauritania http://www.wtng.info/wtng-222-mr.html
356
+ country '223', none >> split(4, 4) # Mali http://www.wtng.info/wtng-223-ml.html
353
357
 
354
358
  # country '224' # Guinea, see special file
355
359
 
@@ -360,8 +364,8 @@ Phony.define do
360
364
  #
361
365
  # There is no trunk code for this country and several of the mobile prefixes start with 0
362
366
  country '225',
363
- trunk('', :normalize => false) |
364
- fixed(2) >> split(2,2,2,2)
367
+ trunk('', normalize: false) |
368
+ fixed(2) >> split(2, 2, 2, 2)
365
369
 
366
370
  # Burkina Faso
367
371
  # http://www.wtng.info/wtng-226-bf.html
@@ -369,12 +373,21 @@ Phony.define do
369
373
  #
370
374
  # There is no trunk code for this country and several of the mobile prefixes start with 0
371
375
  country '226',
372
- trunk('', normalize: false) |
373
- none >> split(2,2,2,2)
376
+ trunk('', normalize: false) |
377
+ none >> split(2, 2, 2, 2)
374
378
 
375
- country '227', none >> split(4,4) # Niger http://www.wtng.info/wtng-227-ne.html
376
- country '228', none >> split(4,4) # Togolese Republic http://www.wtng.info/wtng-228-tg.html
377
- country '229', none >> split(4,4) # Benin http://www.itu.int/oth/T0202000017/en
379
+ country '227', none >> split(4, 4) # Niger http://www.wtng.info/wtng-227-ne.html
380
+ country '228', none >> split(4, 4) # Togolese Republic http://www.wtng.info/wtng-228-tg.html
381
+
382
+ # Benin http://www.itu.int/oth/T0202000017/en
383
+ #
384
+ # There is no trunk code for this country and prefixes start with 0.
385
+ country '229',
386
+ trunk('', normalize: false) |
387
+ none >> matched_split(
388
+ # Old empty and new 01 prefix.
389
+ /\A(01)?\d+\z/ => [2, 2, 2, 2, 2]
390
+ )
378
391
 
379
392
  # Mauritius
380
393
  # http://www.wtng.info/wtng-230-mu.html
@@ -382,21 +395,22 @@ Phony.define do
382
395
  #
383
396
  # There is no trunk code for this country.
384
397
  country '230',
385
- none >> matched_split(
386
- /^5\d{7}$/ => [1,3,4], # Mobile
387
- /^[246]\d{6}$/ => [3,4], # Landline
388
- )
398
+ none >> matched_split(
399
+ /^5\d{7}$/ => [1, 3, 4], # Mobile
400
+ /^[246]\d{6}$/ => [3, 4] # Landline
401
+ )
389
402
 
390
403
  # Liberia
391
404
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LR
392
405
  country '231',
393
- none >> matched_split(
394
- /\A[23]\d+\z/ => [4,4], # LIBTELCO, TEMAS
395
- /\A[4568]\d+\z/ => [4,3], # mobile Lonestar, Libercell, Comium Liberia Inc.
396
- /\A77\d+\z/ => [2,3,4], # http://monrovia.usembassy.gov/contact.html
397
- /\A7\d+\z/ => [4,4], # mobile Cellcom
398
- /\A9\d+\z/ => [4,4], # premium rate Telelinks International SAL, Interactive Media Corporation
399
- )
406
+ none >> matched_split(
407
+ /\A88\d{7}\z/ => [2, 3, 4], # mobile Lonestar Cell MTN
408
+ /\A[23]\d+\z/ => [4, 4], # LIBTELCO, TEMAS
409
+ /\A[4568]\d+\z/ => [4, 3], # mobile Lonestar, Libercell, Comium Liberia Inc.
410
+ /\A77\d+\z/ => [2, 3, 4], # http://monrovia.usembassy.gov/contact.html
411
+ /\A7\d+\z/ => [4, 4], # mobile Cellcom
412
+ /\A9\d+\z/ => [4, 4] # premium rate Telelinks International SAL, Interactive Media Corporation
413
+ )
400
414
 
401
415
  country '232', fixed(2) >> split(3, 3) # Sierra Leone http://www.wtng.info/wtng-232-sl.html
402
416
 
@@ -405,7 +419,7 @@ Phony.define do
405
419
  # From http://www.itu.int/oth/T0202000052/en
406
420
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Ghana
407
421
  #
408
- country '233', trunk('0') | fixed(2) >> split(3,4)
422
+ country '233', trunk('0') | fixed(2) >> split(3, 4)
409
423
 
410
424
  # Nigeria
411
425
  # 3 4 split for mobile and 1 digit NDC, 3 2 or 3 3 otherwise
@@ -415,46 +429,47 @@ Phony.define do
415
429
  # https://www.ncc.gov.ng/technical-regulation/standards/numbering and
416
430
  # https://www.itu.int/oth/T020200009C/en
417
431
  country '234',
418
- match(/^([7-9]0\d)\d+$/) >> split(3,4) | # Mobile
419
- match(/^(81\d)\d+$/) >> split(3,4) | # Mobile
420
- match(/^(91\d)\d+$/) >> split(3,4) | # Mobile
421
- one_of('1', '2') >> split(3,3..4) | # Lagos, Ibadan
422
- one_of('9') >> split(3,4) | # Abuja
423
- one_of((30..79).map(&:to_s)) >> split(3,2..3) | # 2-digit NDC
424
- one_of(%w(82 83 84 85 86 87 88 89)) >> split(3,3) # 2-digit NDC
425
-
426
- country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
427
- country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
428
- country '237', none >> split(3,2,2,2) # Cameroon http://www.wtng.info/wtng-237-cm.html
429
- country '238', none >> split(3,4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
430
- country '239', fixed(1) >> split(3,3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
431
-
432
- country '240', none >> split(3,3,3) # Equatorial Guinea
432
+ match(/^([7-9]0\d)\d+$/) >> split(3, 4) | # Mobile
433
+ match(/^(81\d)\d+$/) >> split(3, 4) | # Mobile
434
+ match(/^(91\d)\d+$/) >> split(3, 4) | # Mobile
435
+ one_of('20') >> split(3, 3..5) | # 2-digit NDC (area code 20) - must come before 1-digit '2'
436
+ one_of('1', '2') >> split(3, 3..4) | # Lagos, Ibadan
437
+ one_of('9') >> split(3, 4) | # Abuja
438
+ one_of((30..79).map(&:to_s)) >> split(3, 2..3) | # 2-digit NDC
439
+ one_of(%w[82 83 84 85 86 87 88 89]) >> split(3, 3) # 2-digit NDC
440
+
441
+ country '235', none >> split(4, 4) # Chad http://www.wtng.info/wtng-235-td.html
442
+ country '236', none >> split(4, 4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
443
+ country '237', none >> split(3, 2, 2, 2) # Cameroon http://www.wtng.info/wtng-237-cm.html
444
+ country '238', none >> split(3, 4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
445
+ country '239', fixed(1) >> split(3, 3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
446
+
447
+ country '240', none >> split(3, 3, 3) # Equatorial Guinea
433
448
  country '241',
434
- match(/^(\d)\d{6}$/) >> split(3,3) | # Gabonese Republic http://www.wtng.info/wtng-241-ga.html
435
- match(/^(\d\d)\d{6}$/) >> split(2,2,2) # 2019 update https://en.wikipedia.org/wiki/Telephone_numbers_in_Gabon
449
+ match(/^(\d)\d{6}$/) >> split(3, 3) | # Gabonese Republic http://www.wtng.info/wtng-241-ga.html
450
+ match(/^(\d\d)\d{6}$/) >> split(2, 2, 2) # 2019 update https://en.wikipedia.org/wiki/Telephone_numbers_in_Gabon
436
451
  country '242', # Congo http://www.wtng.info/wtng-242-cg.html
437
- trunk('', :normalize => false) |
438
- none >> split(4,5)
439
- country '243', fixed(2) >> split(3,4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
440
- country '244', one_of('321', '348', '358', '363', '364', '485', '526', '535', '546', '612', '643', '652', '655', '722', '726', '728', '729', '777') >> split(3,3) | # Angola
441
- fixed(2) >> split(3,4)
442
- country '245', none >> split(2,3,4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
443
- country '246', none >> split(3,4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
452
+ trunk('', normalize: false) |
453
+ none >> split(4, 5)
454
+ country '243', fixed(2) >> split(3, 4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
455
+ country '244', one_of('321', '348', '358', '363', '364', '485', '526', '535', '546', '612', '643', '652', '655', '722', '726', '728', '729', '777') >> split(3, 3) | # Angola
456
+ fixed(2) >> split(3, 4)
457
+ country '245', none >> split(2, 3, 4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
458
+ country '246', none >> split(3, 4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
444
459
  country '247', none >> split(4) # Ascension
445
460
 
446
- country '248', # Seychelles
447
- fixed(1) >> split(2,2,2)
461
+ country '248', # Seychelles
462
+ fixed(1) >> split(2, 2, 2)
448
463
 
449
- country '249', fixed(2) >> split(3,4) # Sudan
464
+ country '249', fixed(2) >> split(3, 4) # Sudan
450
465
 
451
466
  # Rwanda
452
467
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
453
468
  country '250',
454
- trunk('0') |
455
- one_of('25') >> split(7) | # Geographic, fixed
456
- match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
457
- one_of('06') >> split(6) # Satellite
469
+ trunk('0') |
470
+ one_of('25') >> split(7) | # Geographic, fixed
471
+ match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
472
+ one_of('06') >> split(6) # Satellite
458
473
 
459
474
  country '251', fixed(2) >> split(3, 4) # Ethiopia http://www.wtng.info/wtng-251-et.html
460
475
 
@@ -465,40 +480,40 @@ Phony.define do
465
480
  # Kenya
466
481
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
467
482
  country '254',
468
- trunk('0') |
469
- match(/^(7\d\d)/) >> split(6) | # mobile
470
- fixed(2) >> split(7) # landline
483
+ trunk('0') |
484
+ match(/^(7\d\d)/) >> split(6) | # mobile
485
+ fixed(2) >> split(7) # landline
471
486
 
472
487
  # Tanzania.
473
488
  #
474
489
  country '255',
475
- trunk('0') |
476
- match(/^([89]\d\d)/) >> split(3,3) | # Special/Premium.
477
- one_of('112', '118') >> split(3,3) | # Short Codes.
478
- fixed(2) >> split(3,4) # Geographic.
490
+ trunk('0') |
491
+ match(/^([89]\d\d)/) >> split(3, 3) | # Special/Premium.
492
+ one_of('112', '118') >> split(3, 3) | # Short Codes.
493
+ fixed(2) >> split(3, 4) # Geographic.
479
494
 
480
495
  # Uganda.
481
496
  #
482
497
  country '256',
483
- match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
484
- fixed(2) >> split(7) # Geo 2.
498
+ match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
499
+ fixed(2) >> split(7) # Geo 2.
485
500
 
486
- country '257', none >> split(4,4) # Burundi http://www.wtng.info/wtng-257-bi.html
501
+ country '257', none >> split(4, 4) # Burundi http://www.wtng.info/wtng-257-bi.html
487
502
 
488
503
  # Mozambique, https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MZ
489
504
  country '258',
490
- one_of('600') >> split(3,3) | # audiotext
491
- one_of('610') >> split(3,3) | # ISP
492
- one_of('800') >> split(3,3) | # freephone
493
- one_of('801') >> split(3,3) | # local rate
494
- one_of('802') >> split(3,3) | # national rate
495
- one_of(%w(251 252 271 272 281 282 293)) >> split(3,2) |
496
- one_of(%w(21 23 24 26)) >> split(3,3) |
497
- one_of(%w(82 83 84 85 86 87)) >> split(4,3) | # mobile
498
- one_of('89') >> split(4,3) | # satellite GMPCS
499
- one_of('7') >> split(4,4) | # universal access
500
- one_of('9') >> split(4,4) | # premium rate
501
- fixed(2) >> split(3,3)
505
+ one_of('600') >> split(3, 3) | # audiotext
506
+ one_of('610') >> split(3, 3) | # ISP
507
+ one_of('800') >> split(3, 3) | # freephone
508
+ one_of('801') >> split(3, 3) | # local rate
509
+ one_of('802') >> split(3, 3) | # national rate
510
+ one_of(%w[251 252 271 272 281 282 293]) >> split(3, 2) |
511
+ one_of(%w[21 23 24 26]) >> split(3, 3) |
512
+ one_of(%w[82 83 84 85 86 87]) >> split(4, 3) | # mobile
513
+ one_of('89') >> split(4, 3) | # satellite GMPCS
514
+ one_of('7') >> split(4, 4) | # universal access
515
+ one_of('9') >> split(4, 4) | # premium rate
516
+ fixed(2) >> split(3, 3)
502
517
 
503
518
  country '259', todo # -
504
519
 
@@ -508,33 +523,26 @@ Phony.define do
508
523
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Zambia
509
524
 
510
525
  country '260',
511
- trunk('0') |
512
- match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
513
- match(/^(800)/) >> split(3,3) | # Toll free
514
- match(/^(21[1-8])/) >> split(6) # Fixed
526
+ trunk('0') |
527
+ match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
528
+ match(/^(800)/) >> split(3, 3) | # Toll free
529
+ match(/^(21[1-8])/) >> split(6) # Fixed
515
530
 
516
531
  # Madagascar
517
532
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Madagascar
518
533
  # http://www.itu.int/oth/T020200007F/en
519
534
  country '261',
520
- # none >> matched_split(
521
- # /\A20\d+\z/ => [2,2,3,2], # Telecom Malagasy (Telma)
522
- # /\A32\d+\z/ => [2,2,3,2], # mobile Orange Madagascar
523
- # /\A33\d+\z/ => [2,2,3,2], # mobile Airtel Madagascar
524
- # /\A34\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
525
- # /\A38\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
526
- # /\A39\d+\z => [2,2,3,2] # mobile Blueline
527
- # ),
528
- match(/\A(20)\d+\z/) >> split(2,3,2) | # fix Telecom Malagasy (Telma)
529
- match(/\A(32)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
530
- match(/\A(33)\d+\z/) >> split(2,3,2) | # mobile Airtel Madagascar
531
- match(/\A(34)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
532
- match(/\A(38)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
533
- match(/\A(39)\d+\z/) >> split(2,3,2) # mobile Blueline Madagascar
535
+ match(/\A(20)\d+\z/) >> split(2, 3, 2) | # fix Telecom Malagasy (Telma)
536
+ match(/\A(32)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
537
+ match(/\A(33)\d+\z/) >> split(2, 3, 2) | # mobile Airtel Madagascar
538
+ match(/\A(34)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
539
+ match(/\A(37)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
540
+ match(/\A(38)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
541
+ match(/\A(39)\d+\z/) >> split(2, 3, 2) # mobile Blueline Madagascar
534
542
 
535
543
  country '262', # Reunion / Mayotte (new) http://www.wtng.info/wtng-262-fr.html
536
- trunk('0') |
537
- fixed(3) >> split(2,2,2)
544
+ trunk('0') |
545
+ fixed(3) >> split(2, 2, 2)
538
546
 
539
547
  # country '263' # Zimbabwe, see special file
540
548
 
@@ -544,10 +552,10 @@ Phony.define do
544
552
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MW
545
553
  country '265',
546
554
  none >> matched_split(
547
- /\A(21|77)\d+\z/ => [3,3,3], # geographic, mobile
548
- /\A(88|99)\d{7}\z/ => [3,3,3], # mobile
549
- /\A18(00|11|18|20)\z/ => [4], # ISP
550
- /\A\d+\z/ => [4,3]
555
+ /\A(21|77)\d+\z/ => [3, 3, 3], # geographic, mobile
556
+ /\A(88|99)\d{7}\z/ => [3, 3, 3], # mobile
557
+ /\A18(00|11|18|20)\z/ => [4], # ISP
558
+ /\A\d+\z/ => [4, 3]
551
559
  )
552
560
 
553
561
  country '266', none >> split(4, 4) # Lesotho http://www.wtng.info/wtng-266-ls.html
@@ -556,39 +564,39 @@ Phony.define do
556
564
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
557
565
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=BW
558
566
  country '267',
559
- one_of(%w(463 495 499 590)) >> split(4) |
560
- one_of(%w(24 26 29 31 46 47 49 53 54 57 58 59 62 65 68)) >> split(3,2) |
561
- one_of('79') >> split(3,3) | # VoIP telephony
562
- one_of('80') >> split(3,3) | # freephone
563
- one_of('90') >> split(3,3) | # premium rate
564
- one_of('7') >> split(4,3) | # moblie
565
- one_of('8') >> split(4,3) | # shared cost
566
- one_of('3') >> split(3,3) |
567
- fixed(2) >> split(3,2)
567
+ one_of(%w[463 495 499 590]) >> split(4) |
568
+ one_of(%w[24 26 29 31 46 47 49 53 54 57 58 59 62 65 68]) >> split(3, 2) |
569
+ one_of('79') >> split(3, 3) | # VoIP telephony
570
+ one_of('80') >> split(3, 3) | # freephone
571
+ one_of('90') >> split(3, 3) | # premium rate
572
+ one_of('7') >> split(4, 3) | # moblie
573
+ one_of('8') >> split(4, 3) | # shared cost
574
+ one_of('3') >> split(3, 3) |
575
+ fixed(2) >> split(3, 2)
568
576
 
569
577
  # Swaziland http://www.wtng.info/wtng-268-sz.html
570
578
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SZ
571
579
  country '268',
572
580
  none >> matched_split(
573
- /\A08\d+\z/ => [4,3], # freephone
574
- /\A(2200|2300|2538|2548)\d+\z/ => [4,4], # VoIP telephony Swaziland Posts and Telecommunications Corporation (SPTC)
575
- /\A(2400|76)\d+\z/ => [4,4], # mobile Swazi MTN Ltd
576
- /\A(2550|2551)\d+\z/ => [4,4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
577
- /\A(550|551)\d+\z/ => [3,4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
578
- /\A(22|23|24|25)\d+\z/ => [4,4], # geographic SPTC
579
- /\A77\d+\z/ => [4,4], # mobile Swaziland Posts and Telecommunications Corporation (SPTC) (CDMA)
580
- /\A78\d+\z/ => [4,4], # mobile Swazi MTN Ltd
581
+ /\A08\d+\z/ => [4, 3], # freephone
582
+ /\A(2200|2300|2538|2548)\d+\z/ => [4, 4], # VoIP telephony Swaziland Posts and Telecommunications Corporation (SPTC)
583
+ /\A(2400|76)\d+\z/ => [4, 4], # mobile Swazi MTN Ltd
584
+ /\A(2550|2551)\d+\z/ => [4, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
585
+ /\A(550|551)\d+\z/ => [3, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
586
+ /\A(22|23|24|25)\d+\z/ => [4, 4], # geographic SPTC
587
+ /\A77\d+\z/ => [4, 4], # mobile Swaziland Posts and Telecommunications Corporation (SPTC) (CDMA)
588
+ /\A78\d+\z/ => [4, 4] # mobile Swazi MTN Ltd
581
589
  )
582
590
 
583
591
  # Comoros http://www.wtng.info/wtng-269-km.html
584
592
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KM
585
593
  country '269',
586
594
  none >> matched_split(
587
- /\A800\d+\z/ => [4,3,3], # freephone Toll-free Global269
588
- /\A(763|77)\d+\z/ => [4,3], # geographic Comores Télécom
589
- /\A(32|33|34)\d+\z/ => [4,3], # mobile Comores Télécom (HURI)
590
- /\A(390|391|900|910)\d+\z/ => [4,3], # premium rate WIAIR SARL
591
- /\A(76)\d+\z/ => [4,3] # wireless geographic Comores Télécom
595
+ /\A800\d+\z/ => [4, 3, 3], # freephone Toll-free Global269
596
+ /\A(763|77)\d+\z/ => [4, 3], # geographic Comores Télécom
597
+ /\A(32|33|34)\d+\z/ => [4, 3], # mobile Comores Télécom (HURI)
598
+ /\A(390|391|900|910)\d+\z/ => [4, 3], # premium rate WIAIR SARL
599
+ /\A(76)\d+\z/ => [4, 3] # wireless geographic Comores Télécom
592
600
  )
593
601
 
594
602
  country '280', todo # -
@@ -618,20 +626,20 @@ Phony.define do
618
626
  # Faroe Islands http://www.wtng.info/wtng-298-fo.html
619
627
  country '298',
620
628
  none >> matched_split(
621
- /\A1\d+\z/ => [4], # universal access: Føroya Tele; ISP: Kall, Føroya Tele
622
- /\A\d+\z/ => [3,3]
629
+ /\A1\d+\z/ => [4], # universal access: Føroya Tele; ISP: Kall, Føroya Tele
630
+ /\A\d+\z/ => [3, 3]
623
631
  )
624
632
 
625
633
  # Greenland http://www.wtng.info/wtng-299-gl.html
626
634
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
627
635
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GL
628
636
  country '299',
629
- one_of(%w(199 691)) >> split(3) | # satellite; geographic: Ivittuut
630
- one_of(%w(31 32 33 34 35 36 61 64 66 68 81 84 85 86 87 89 91 92 94 95 96 97 98 99)) >> split(4) | # geographic
631
- one_of(%w(22 23 24 25 26 27 28 29 42 43 44 45 46 47 48 49 52 53 54 55 56 57 58 59)) >> split(4) | # mobile: Tele Greenland A/S
632
- one_of(%w(38 39)) >> split(4) | # VoIP telephony
633
- match(/\A(50)\d{4}\z/) >> split(4) | #| voicemail (mobile) Tele Greenland A/S
634
- match(/\A(50)\d{6}\z/) >> split(3,3) | #|
637
+ one_of(%w[199 691]) >> split(3) | # satellite; geographic: Ivittuut
638
+ one_of(%w[31 32 33 34 35 36 61 64 66 68 81 84 85 86 87 89 91 92 94 95 96 97 98 99]) >> split(4) | # geographic
639
+ one_of(%w[22 23 24 25 26 27 28 29 42 43 44 45 46 47 48 49 52 53 54 55 56 57 58 59]) >> split(4) | # mobile: Tele Greenland A/S
640
+ one_of(%w[38 39]) >> split(4) | # VoIP telephony
641
+ match(/\A(50)\d{4}\z/) >> split(4) | # | voicemail (mobile) Tele Greenland A/S
642
+ match(/\A(50)\d{6}\z/) >> split(3, 3) | # |
635
643
  fixed(2) >> split(4)
636
644
 
637
645
  # Gibraltar
@@ -643,36 +651,36 @@ Phony.define do
643
651
  # Portugal.
644
652
  #
645
653
  country '351',
646
- match(/^([78]\d\d)\d+$/) >> split(3,3) | # Service.
647
- match(/^(9\d)\d+$/) >> split(3,4) | # Mobile.
648
- one_of('21', '22') >> split(3,4) | # Lisboa & Porto
649
- fixed(3) >> split(3,3) # 3-digit NDCs
654
+ match(/^([78]\d\d)\d+$/) >> split(3, 3) | # Service.
655
+ match(/^(9\d)\d+$/) >> split(3, 4) | # Mobile.
656
+ one_of('21', '22') >> split(3, 4) | # Lisboa & Porto
657
+ fixed(3) >> split(3, 3) # 3-digit NDCs
650
658
 
651
659
  # Luxembourg
652
660
  #
653
661
  country '352',
654
- match(/^(2[467]\d{2})\d{4}$/) >> split(2,2) | # 4-digit NDC
655
- match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
656
- match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
657
- match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
658
- match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
659
- match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2,2,1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
660
- match(/^((2[^467]|[2-9]\d))\d{6}$/) >> split(2,2,2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
661
- match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2,2,3) | # 2-digit NDC Regular 6 digits with 4 digits extension
662
- match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2,2,4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
663
- match(/^(\d{2})\d{3}$/) >> split(2,2,1) # fallback for 5 digit number
662
+ match(/^(2[467]\d{2})\d{4}$/) >> split(2, 2) | # 4-digit NDC
663
+ match(/^(6\d[18])\d+$/) >> split(3, 3) | # mobile
664
+ match(/^(60\d{2})\d{8}$/) >> split(2, 2, 2, 2) | # mobile machine to machine
665
+ match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
666
+ match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
667
+ match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2, 2, 1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
668
+ match(/^((2[^467]|[2-9]\d))\d{6}$/) >> split(2, 2, 2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
669
+ match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2, 2, 3) | # 2-digit NDC Regular 6 digits with 4 digits extension
670
+ match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2, 2, 4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
671
+ match(/^(\d{2})\d{3}$/) >> split(2, 2, 1) # fallback for 5 digit number
664
672
 
665
673
  # country '353' # Republic of Ireland, see special file.
666
674
 
667
- country '354', none >> split(3,4) # Iceland
675
+ country '354', none >> split(3, 4) # Iceland
668
676
 
669
677
  # Albania
670
678
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Albania
671
679
  country '355', trunk('0') |
672
- one_of('4') >> split(3,4) | # Tirana
673
- match(/\A(6[6-9])\d*\z/) >> split(3,4) | # mobile
674
- match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3,3) |
675
- fixed(3) >> split(3,2)
680
+ one_of('4') >> split(3, 4) | # Tirana
681
+ match(/\A(6[6-9])\d*\z/) >> split(3, 4) | # mobile
682
+ match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3, 3) |
683
+ fixed(3) >> split(3, 2)
676
684
 
677
685
  # Malta
678
686
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Malta
@@ -684,8 +692,8 @@ Phony.define do
684
692
  # Cyprus
685
693
  # http://www.cytaglobal.com/cytaglobal/userfiles/NewNumberingPlan.pdf
686
694
  country '357', trunk('0') |
687
- one_of('121','122','123') >> split(2,6) | # voicemail
688
- fixed(2) >> split(6) # fixed & mobile
695
+ one_of('121', '122', '123') >> split(2, 6) | # voicemail
696
+ fixed(2) >> split(6) # fixed & mobile
689
697
 
690
698
  # Finland
691
699
  #
@@ -696,9 +704,9 @@ Phony.define do
696
704
  match(/^(73[0-4]\d\d)\d{5}$/) >> split(5) | # national subscriber numbers, 5-digit NDC (starting with 073)
697
705
  match(/^(202[023]|209[8-9]|600[0126-9]|700[0126]|7099|800\d)\d{4,5}$/) >> split(2, 2..3) | # national service numbers, 4-digit NDCs
698
706
  match(/^(606\d|70[78]\d)\d{6}$/) >> split(3, 3) | # national service numbers, 4-digit NDCs (starting with 0606/0707/0708)
699
- match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) | # national subscriber numbers, 4-digit NDCs
707
+ match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) | # national subscriber numbers, 4-digit NDCs
700
708
  match(/^(45[45789]\d)\d{2,6}$/) >> split(2, 0..4) | # mobile numbers, 4-digit NDCs
701
- match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) | # national service numbers, 3-digit NDCs
709
+ match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) | # national service numbers, 3-digit NDCs
702
710
  match(/^(10[1-9]|20[13-8]|30[1-9]|73[5-9])\d{5,7}$/) >> split(3, 2..4) | # national subscriber numbers, 3-digit NDCs
703
711
  match(/^(71\d)\d{6}$/) >> split(3, 3) | # national subscriber numbers, 3-digit NDCs (starting with 071)
704
712
  match(/^(73[5-9])\d{7}$/) >> split(3, 4) | # national subscriber numbers, 3-digit NDCs (starting with 073)
@@ -706,8 +714,8 @@ Phony.define do
706
714
  match(/^(49\d)\d{8}$/) >> split(3, 3, 2) | # mobile numbers, 3-digit NDCs (starting with 049)
707
715
  match(/^([235]9)\d{6,8}$/) >> split(3, 3, 0..2) | # national subscriber numbers, 2-digit NDCs
708
716
  match(/^(4[0124678]|50)\d{4,8}$/) >> split(3, 1..5) | # mobile numbers, 2-digit NDCs
709
- one_of('2','3','5','6','8','9') >> split(3,1..5) | # Short NDCs
710
- fixed(2) >> split(3, 0..4) # 2-digit NDCs
717
+ one_of('2', '3', '5', '6', '8', '9') >> split(3, 1..5) | # Short NDCs
718
+ fixed(2) >> split(3, 0..4) # 2-digit NDCs
711
719
 
712
720
  # Bulgaria
713
721
  #
@@ -715,34 +723,30 @@ Phony.define do
715
723
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Bulgaria
716
724
  country '359',
717
725
  trunk('0') |
718
- match(/^(2)\d{6}$/) >> split(3,3) | # Landline Sofia (optional last digit)
719
- match(/^(2)\d{7}$/) >> split(3,4) | # Landline Sofia (optional last digit)
726
+ match(/^(2)\d{6}$/) >> split(3, 3) | # Landline Sofia (optional last digit)
727
+ match(/^(2)\d{7}$/) >> split(3, 4) | # Landline Sofia (optional last digit)
720
728
  match(/^(30|31|33|36|37|39|41|43\d|45|47|51|53|55|57|59)\d{5}$/) >> split(5) |
721
- match(/^(30|31|32|33|34|35|36|37|38|39|41|42|44|45|46|47|51|52|53|54|55|56|57|58|59)\d{6}$/) >> split(2,4) |
722
-
729
+ match(/^(30|31|32|33|34|35|36|37|38|39|41|42|44|45|46|47|51|52|53|54|55|56|57|58|59)\d{6}$/) >> split(2, 4) |
723
730
  match(/^(60|61|63|65|66|69)\d{5}$/) >> split(5) |
724
731
  match(/^(60|61|62|63|64|65|66|68|69)\d{6}$/) >> split(6) |
725
-
726
732
  match(/^(700|701|703|704|705|706|707|708|709)\d{5}$/) >> split(5) |
727
733
  match(/^(701|702|703|704|705|706|707|708|709)\d{4}$/) >> split(4) |
728
-
729
734
  match(/^(71|72|74|75|77)\d{5}$/) >> split(5) |
730
735
  match(/^(71|72|73|74|75|76|77|78|79)\d{6}$/) >> split(6) |
731
-
732
736
  match(/^(80\d|81|91|93|95|97)\d{5}$/) >> split(5) |
733
737
  match(/^(81|82|84|86)\d{6}$/) >> split(6) |
734
- match(/^(87|88|89)\d{7}$/) >> split(4,3) |
738
+ match(/^(87|88|89)\d{7}$/) >> split(4, 3) |
735
739
  match(/^(90|91|92|93|94|95|96|97|98\d|99\d)\d{6}$/) >> split(6)
736
740
 
737
741
  # Lithuania
738
742
  #
739
743
  country '370',
740
744
  trunk('8', normalize: false) |
741
- one_of('700', '800') >> split(2,3) | # Service
742
- match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
743
- one_of('5') >> split(3,2,2) | # Vilnius
744
- one_of('37','41') >> split(2,2,2) | # Kaunas, Šiauliai
745
- fixed(3) >> split(1,2,2) # 3-digit NDCs.
745
+ one_of('700', '800') >> split(2, 3) | # Service
746
+ match(/^(6\d\d)\d+$/) >> split(2, 3) | # Mobile
747
+ one_of('5') >> split(3, 2, 2) | # Vilnius
748
+ one_of('37', '41') >> split(2, 2, 2) | # Kaunas, Šiauliai
749
+ fixed(3) >> split(1, 2, 2) # 3-digit NDCs.
746
750
 
747
751
  # country '371' # Latvia, see special file
748
752
 
@@ -751,7 +755,7 @@ Phony.define do
751
755
  country '372',
752
756
  match(/^(5\d\d\d)\d+$/) >> split(3..4) | # Mobile
753
757
  match(/^((?:70|8[12])\d\d)\d+$/) >> split(4) | # Mobile
754
- fixed(3) >> split(4) # 3-digit NDCs
758
+ fixed(3) >> split(4) # 3-digit NDCs
755
759
 
756
760
  # country '373' # Moldova, see special file
757
761
 
@@ -766,15 +770,15 @@ Phony.define do
766
770
  # Monaco
767
771
  #
768
772
  country '377',
769
- one_of('6') >> split(2,2,2,2) | # mobile
770
- fixed(2) >> split(2,2,2)
773
+ one_of('6') >> split(2, 2, 2, 2) | # mobile
774
+ fixed(2) >> split(2, 2, 2)
771
775
 
772
776
  # San Marino
773
777
  country '378',
774
- trunk('', :normalize => false) |
778
+ trunk('', normalize: false) |
775
779
  none >> matched_split(
776
- /\A\d{6}\z/ => [3,3],
777
- /\A\d+\z/ => [3,3,4]
780
+ /\A\d{6}\z/ => [3, 3],
781
+ /\A\d+\z/ => [3, 3, 4]
778
782
  )
779
783
 
780
784
  country '379', todo # Vatican City State
@@ -790,7 +794,7 @@ Phony.define do
790
794
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Kosovo
791
795
  country '383',
792
796
  trunk('0') |
793
- fixed(2) >> split(3,3)
797
+ fixed(2) >> split(3, 3)
794
798
 
795
799
  country '384', todo # -
796
800
 
@@ -801,19 +805,26 @@ Phony.define do
801
805
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Slovenia
802
806
  country '386',
803
807
  trunk('0') |
804
- one_of('30','31','40','41','51','64','65','66','67','68','69','70','71') >> split(3,3) | # Mobile
805
- one_of('1','2','3','4','5','7') >> split(3,4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
806
- fixed(3) >> split(2,3) # catchall
808
+ one_of('30', '31', '40', '41', '51', '64', '65', '66', '67', '68', '69', '70', '71') >> split(3, 3) | # Mobile
809
+ one_of('1', '2', '3', '4', '5', '7') >> split(3, 4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
810
+ fixed(3) >> split(2, 3) # catchall
811
+
812
+ # Bosnia and Herzegovina
813
+ country '387',
814
+ trunk('0') |
815
+ match(/^(60)(?:31|32|33|34|38|39)/) >> split(7) | # BH Mobile
816
+ match(/^(64)(?:40|41|42|43|44|45)/) >> split(7) | # Haloo
817
+ match(/^(67)(?:11|12)/) >> split(7) | # Novotel
818
+ fixed(2) >> split(3, 3) # catchall
807
819
 
808
- country '387', trunk('0') | fixed(2) >> split(3,3) # Bosnia and Herzegovina
809
- country '388', trunk('0') | fixed(2) >> split(3,2,2) # Group of countries, shared code
820
+ country '388', trunk('0') | fixed(2) >> split(3, 2, 2) # Group of countries, shared code
810
821
 
811
822
  # The Former Yugoslav Republic of Macedonia
812
823
  country '389',
813
- trunk('0') |
814
- one_of('2','3','4','5','6','7','8') >> split(3,4)
824
+ trunk('0') |
825
+ one_of('2', '3', '4', '5', '6', '7', '8') >> split(3, 4)
815
826
 
816
- country '420', fixed(3) >> split(3,3) # Czech Republic
827
+ country '420', fixed(3) >> split(3, 3) # Czech Republic
817
828
 
818
829
  # Slovak Republic.
819
830
  #
@@ -824,7 +835,7 @@ Phony.define do
824
835
  fixed(2) >> split(7) # 2-digit NDCs
825
836
 
826
837
  country '422', todo # Spare code
827
- country '423', none >> split(3,2,2) # Liechtenstein (Principality of)
838
+ country '423', none >> split(3, 2, 2) # Liechtenstein (Principality of)
828
839
  country '424', todo # -
829
840
  country '425', todo # -
830
841
  country '426', todo # -
@@ -832,74 +843,75 @@ Phony.define do
832
843
  country '428', todo # -
833
844
  country '429', todo # -
834
845
 
835
- country '500', none >> split(2,3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
846
+ country '500', none >> split(2, 3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
836
847
  country '501', fixed(3) >> split(4) # Belize
837
848
 
838
849
  # Guatemala (Republic of) http://www.wtng.info/wtng-502-gt.html
839
850
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
840
851
  #
841
852
  country '502',
842
- one_of('19') >> split(3,3,3) | # premium rate
843
- fixed(1) >> split(3,4)
853
+ one_of('19') >> split(3, 3, 3) | # premium rate
854
+ fixed(1) >> split(3, 4)
844
855
 
845
- # El Salvador (Republic of)
856
+ # El Salvador (Republic of)
846
857
  country '503', fixed(4) >> split(4)
847
858
 
848
859
  # Honduras (Republic of) http://www.wtng.info/wtng-504-hn.html
849
860
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
850
861
  country '504',
851
- one_of('800') >> split(3,4) | # freephone
852
- fixed(2) >> split(3,3) # geographic, mobile
862
+ one_of('800') >> split(3, 4) | # freephone
863
+ fixed(2) >> split(3, 3) # geographic, mobile
853
864
 
854
865
  # Nicaragua http://www.wtng.info/wtng-505-ni.html
855
866
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
856
867
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=NI
857
868
  country '505',
858
- one_of('9') >> split(3,3) | # premium rate
859
- fixed(2) >> split(3,3) # geographic, mobile
869
+ one_of('9') >> split(3, 3) | # premium rate
870
+ fixed(2) >> split(3, 3) # geographic, mobile
860
871
 
861
872
  # Costa Rica http://www.wtng.info/wtng-506-cr.html
862
873
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
863
874
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=CR
864
875
  country '506',
865
- one_of('800') >> split(3,4) | # freephone
866
- one_of(%w(905 909)) >> split(3,4) | # premium rate
867
- fixed(1) >> split(3,4) # geographic
876
+ one_of('800') >> split(3, 4) | # freephone
877
+ one_of(%w[905 909]) >> split(3, 4) | # premium rate
878
+ fixed(1) >> split(3, 4) # geographic
868
879
 
869
880
  # Panama (Republic of) http://www.wtng.info/wtng-507-pa.html
870
881
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
871
882
  country '507',
872
- one_of(%w(800 809)) >> split(4) | # freephone
873
- one_of('6') >> split(3,4) | # mobile
874
- fixed(1) >> split(3,3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
883
+ one_of(%w[800 809]) >> split(4) | # freephone
884
+ one_of('6') >> split(3, 4) | # mobile
885
+ fixed(1) >> split(3, 3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
875
886
 
876
887
  country '508', none >> split(3, 3) # Saint Pierre and Miquelon (Collectivité territoriale de la République française) http://www.wtng.info/wtng-508-pm.html
877
888
 
878
889
  country '509', # Haiti (Republic of)
879
- fixed(2) >> split(2,4)
890
+ fixed(2) >> split(2, 4)
880
891
 
881
892
  # Guadeloupe (French Department of) http://www.wtng.info/wtng-590-fr.html
882
893
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
883
894
  country '590', trunk('0') |
884
- fixed(3) >> split(2,2,2)
895
+ fixed(3) >> split(2, 2, 2)
885
896
 
886
897
  country '591', # Bolivia (Republic of) http://www.itu.int/oth/T020200001A/en
887
- fixed(1) >> split(3,4)
898
+ fixed(1) >> split(3, 4)
888
899
 
889
900
  # Guyana http://www.wtng.info/wtng-592-gy.html
890
901
  # https://www.numberingplans.com
891
902
  country '592',
892
903
  one_of('10') >> split(2) | # audiotext
893
- one_of(%w(11 16 17 18 19)) >> split(3) | # audiotext
904
+ one_of(%w[11 16 17 18 19]) >> split(3) | # audiotext
894
905
  fixed(3) >> split(4) # geographic, audiotext
895
906
 
896
907
  # Ecuador http://www.wtng.info/wtng-593-ec.html
897
908
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=EC&current_page=1
898
909
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Ecuador
899
910
  country '593',
900
- one_of('9') >> split(4,4) |
901
- match(/\A([\d]{2})\d{7}\z/) >> split(3,4) |
902
- fixed(1) >> split(3,4)
911
+ match(/\A(1800)\d+\z/) >> split(3, 3) | # toll free 1800 numbers
912
+ one_of('9') >> split(4, 4) |
913
+ match(/\A([\d]{2})\d{7}\z/) >> split(3, 4) |
914
+ fixed(1) >> split(3, 4)
903
915
 
904
916
  country '594', fixed(3) >> split(3, 3) # French Guiana (French Department of) http://www.wtng.info/wtng-594-fr.html
905
917
 
@@ -907,25 +919,25 @@ Phony.define do
907
919
 
908
920
  # Martinique (French Department of) http://www.wtng.info/wtng-596-mq.html, https://www.numberingplans.com
909
921
  country '596', trunk('0') |
910
- fixed(3) >> split(2,2,2)
922
+ fixed(3) >> split(2, 2, 2)
911
923
 
912
924
  # Suriname (Republic of) http://www.wtng.info/wtng-597-sr.html, https://www.numberingplans.com
913
925
  country '597',
914
926
  none >> matched_split(
915
- /\A[6789]\d+\z/ => [3,4], # freephone, mobile
916
- /\A[2345]\d+\z/ => [3,3], # geographic, VoIP telephony
927
+ /\A[6789]\d+\z/ => [3, 4], # freephone, mobile
928
+ /\A[2345]\d+\z/ => [3, 3] # geographic, VoIP telephony
917
929
  )
918
930
 
919
931
  # country '598' # Uruguay (Eastern Republic of), see special file
920
932
 
921
- country '599', one_of('9') >> split(3,4) | # Netherlands Antilles (Curacao)
922
- fixed(3) >> split(4) # (other)
933
+ country '599', one_of('9') >> split(3, 4) | # Netherlands Antilles (Curacao)
934
+ fixed(3) >> split(4) # (other)
923
935
 
924
936
  # Democratic Republic of Timor-Leste http://www.wtng.info/wtng-670-tl.html
925
937
  country '670',
926
938
  none >> matched_split(
927
- /\A7\d+\z/ => [4,4], # mobile
928
- /\A\d+\z/ => [3,4]
939
+ /\A7\d+\z/ => [4, 4], # mobile
940
+ /\A\d+\z/ => [3, 4]
929
941
  )
930
942
 
931
943
  country '671', todo # Spare code
@@ -933,7 +945,7 @@ Phony.define do
933
945
  # Australian External Territories https://en.wikipedia.org/wiki/Telephone_numbers_in_Norfolk_Island
934
946
  # Norfolk Island
935
947
  country '672',
936
- fixed(1) >> split(2,3) |
948
+ fixed(1) >> split(2, 3) |
937
949
  match(/^(2\d+)$/) >> split(3) | # Fixed
938
950
  match(/^(5\d+)$/) >> split(3) # Mobile
939
951
 
@@ -943,56 +955,56 @@ Phony.define do
943
955
  # Papua New Guinea
944
956
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PG
945
957
  country '675',
946
- one_of(%w(180 181 182 183)) >> split(4) | # freephone
958
+ one_of(%w[180 181 182 183]) >> split(4) | # freephone
947
959
  one_of('170') >> split(2) | # mobile
948
960
  one_of('189') >> split(1) | # mobile
949
- one_of('184') >> split(4,4) | # ISP, PSDN X.28
950
- one_of(%w(185 270 271)) >> split(4) | # pager
951
- one_of(%w(275 276)) >> split(4) | # satellite
952
- one_of(%w(278 279)) >> split(2) | # satellite
953
- one_of('115') >> split(4,4) | # voicemail (mobile)
954
- one_of(%w(28 29)) >> split(3,2) | # pager
955
- one_of(%w(16 18)) >> split(3,2) | # ISP
956
- one_of(%w(70 71 72 74 75 76 78 79)) >> split(3,3) | # mobile
957
- one_of(%w(731 732 733 734 735 736 738 739)) >> split(2,3) | # mobile
958
- one_of(%w(770)) >> split(2,3) | # wireless geographic; Port Moresby, National Capital District
959
- one_of(%w(771)) >> split(2,3) | # wireless geographic; Momase region
960
- one_of(%w(772)) >> split(2,3) | # wireless geographic; Highlands region
961
- one_of(%w(7730)) >> split(1,3) | # wireless geographic; Southern region
962
- one_of(%w(774)) >> split(2,3) | # wireless geographic; Islands region
963
- one_of(%w(775)) >> split(2,3) | # mobile
964
- one_of(%w(80 81 82 83)) >> split(3,3) | # freephone
965
- one_of(%w(90 91 92 93)) >> split(3,3) | # geographic, ISDN
966
- one_of(%w(3 4 5 6 7 8 9)) >> split(3,3) # geographic
967
- fixed(1) >> split(3,3) # geographic
961
+ one_of('184') >> split(4, 4) | # ISP, PSDN X.28
962
+ one_of(%w[185 270 271]) >> split(4) | # pager
963
+ one_of(%w[275 276]) >> split(4) | # satellite
964
+ one_of(%w[278 279]) >> split(2) | # satellite
965
+ one_of('115') >> split(4, 4) | # voicemail (mobile)
966
+ one_of(%w[28 29]) >> split(3, 2) | # pager
967
+ one_of(%w[16 18]) >> split(3, 2) | # ISP
968
+ one_of(%w[70 71 72 74 75 76 78 79]) >> split(3, 3) | # mobile
969
+ one_of(%w[731 732 733 734 735 736 738 739]) >> split(2, 3) | # mobile
970
+ one_of(%w[770]) >> split(2, 3) | # wireless geographic; Port Moresby, National Capital District
971
+ one_of(%w[771]) >> split(2, 3) | # wireless geographic; Momase region
972
+ one_of(%w[772]) >> split(2, 3) | # wireless geographic; Highlands region
973
+ one_of(%w[7730]) >> split(1, 3) | # wireless geographic; Southern region
974
+ one_of(%w[774]) >> split(2, 3) | # wireless geographic; Islands region
975
+ one_of(%w[775]) >> split(2, 3) | # mobile
976
+ one_of(%w[80 81 82 83]) >> split(3, 3) | # freephone
977
+ one_of(%w[90 91 92 93]) >> split(3, 3) | # geographic, ISDN
978
+ one_of(%w[3 4 5 6 7 8 9]) >> split(3, 3) # geographic
979
+ fixed(1) >> split(3, 3) # geographic
968
980
 
969
981
  # Tonga (Kingdom of)
970
982
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=TO
971
983
  country '676',
972
984
  none >> matched_split(
973
- /\A(77|78|87|88|89)\d+\z/ => [2,3,2],
974
- /\A\d+\z/ => [2,3]
985
+ /\A(77|78|87|88|89)\d+\z/ => [2, 3, 2],
986
+ /\A\d+\z/ => [2, 3]
975
987
  )
976
988
 
977
989
  # Solomon Islands http://www.wtng.info/wtng-677-sb.html, https://www.numberingplans.com
978
990
  country '677',
979
991
  none >> matched_split(
980
- /\A7\d+\z/ => [4,3], # mobile
981
- /\A\d+\z/ => [2,3] # freephone, geographic, mobile, VoIP telephony
992
+ /\A7\d+\z/ => [4, 3], # mobile
993
+ /\A\d+\z/ => [2, 3] # freephone, geographic, mobile, VoIP telephony
982
994
  )
983
995
 
984
996
  # Vanuatu (Republic of) http://www.wtng.info/wtng-678-vu.html, https://www.numberingplans.com
985
997
  country '678',
986
998
  none >> matched_split(
987
- /\A[579]\d+\z/ => [4,3], # mobile
988
- /\A\d+\z/ => [2,3] # geographic, VoIP telephony
999
+ /\A[579]\d+\z/ => [4, 3], # mobile
1000
+ /\A\d+\z/ => [2, 3] # geographic, VoIP telephony
989
1001
  )
990
1002
 
991
1003
  country '679', none >> split(3, 4) # Fiji (Republic of) http://www.wtng.info/wtng-679-fj.html
992
1004
 
993
1005
  country '680', none >> split(3, 4) # Palau (Republic of) http://www.wtng.info/wtng-680-pw.html
994
1006
  country '681', todo # Wallis and Futuna (Territoire français d'outre-mer)
995
- country '682', none >> split(2,3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
1007
+ country '682', none >> split(2, 3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
996
1008
  country '683', none >> split(4) # Niue http://www.wtng.info/wtng-683-nu.html
997
1009
  country '684', todo # -
998
1010
 
@@ -1000,18 +1012,18 @@ Phony.define do
1000
1012
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=WS
1001
1013
  country '685',
1002
1014
  none >> matched_split(
1003
- /\A800\d+\z/ => [3,3], # freephone
1004
- /\A830\d+\z/ => [3,3], # shared cost
1005
- /\A60\d+\z/ => [3,3], # wireless geographic
1006
- /\A(71|72|75|76|77)\d+\z/ => [3,4], # mobile
1007
- /\A84\d+\z/ => [3,4], # wireless geographic
1008
- /\A\d+\z/ => [2,3] # geographic
1015
+ /\A800\d+\z/ => [3, 3], # freephone
1016
+ /\A830\d+\z/ => [3, 3], # shared cost
1017
+ /\A60\d+\z/ => [3, 3], # wireless geographic
1018
+ /\A(71|72|75|76|77)\d+\z/ => [3, 4], # mobile
1019
+ /\A84\d+\z/ => [3, 4], # wireless geographic
1020
+ /\A\d+\z/ => [2, 3] # geographic
1009
1021
  )
1010
1022
 
1011
1023
  country '686', none >> split(8) # Kiribati (Republic of) https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KI
1012
- country '687', none >> split(3,3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
1024
+ country '687', none >> split(3, 3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
1013
1025
  country '688', none >> split(5) # Tuvalu http://www.wtng.info/wtng-688-tv.html
1014
- country '689', none >> split(2,2,2,2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
1026
+ country '689', none >> split(2, 2, 2, 2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
1015
1027
 
1016
1028
  country '690', fixed(1) >> split(3) # Tokelau http://www.wtng.info/wtng-690-tk.html
1017
1029
  country '691', none >> split(3, 4) # Micronesia (Federated States of) http://www.wtng.info/wtng-691-fm.html
@@ -1052,14 +1064,15 @@ Phony.define do
1052
1064
  # Democratic People's Republic of Korea
1053
1065
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KP
1054
1066
  country '850',
1055
- one_of(%w(191 192 193)) >> split(3,4) | # mobile
1067
+ one_of(%w[191 192 193]) >> split(3, 4) | # mobile
1056
1068
  one_of('2') >> matched_split(
1057
- /\A\d{5}\z/ => [3,2],
1058
- /\A\d{7}\z/ => [3,4],
1059
- #/\A(880|881|882|883|885)\d+\z/ => [4,4,4,4],
1060
- /\A\d+\z/ => [3,3,3]) |
1061
- one_of(%w(31 39 41 45 53 57 61 67 73 79)) >> split(3,3) |
1062
- fixed(2) >> split(3,3)
1069
+ /\A\d{5}\z/ => [3, 2],
1070
+ /\A\d{7}\z/ => [3, 4],
1071
+ # /\A(880|881|882|883|885)\d+\z/ => [4,4,4,4],
1072
+ /\A\d+\z/ => [3, 3, 3]
1073
+ ) |
1074
+ one_of(%w[31 39 41 45 53 57 61 67 73 79]) >> split(3, 3) |
1075
+ fixed(2) >> split(3, 3)
1063
1076
 
1064
1077
  country '851', todo # Spare code
1065
1078
 
@@ -1067,22 +1080,22 @@ Phony.define do
1067
1080
 
1068
1081
  country '852',
1069
1082
  match(/^(800)\d+$/) >> split(2, 4) |
1070
- none >> split(4,4)
1083
+ none >> split(4, 4)
1071
1084
 
1072
1085
  # Macao, China
1073
1086
  country '853', # Macao, China
1074
- match(/^(28)\d+$/) >> split(2,4) | # Landline.
1075
- match(/^(8)\d+$/) >> split(3,4) | # Landline.
1076
- match(/^(6)\d+$/) >> split(3,4) # Mobile.
1087
+ match(/^(28)\d+$/) >> split(2, 4) | # Landline.
1088
+ match(/^(8)\d+$/) >> split(3, 4) | # Landline.
1089
+ match(/^(6)\d+$/) >> split(3, 4) # Mobile.
1077
1090
 
1078
1091
  country '854', todo # Spare code
1079
1092
 
1080
1093
  # Lao People's Democratic Republic http://www.wtng.info/wtng-856-la.html, https://www.numberingplans.com
1081
1094
  country '856',
1082
1095
  trunk('0') |
1083
- one_of('30') >> split(3,4) | # geographic
1084
- one_of('20') >> split(4,4) | # mobile
1085
- fixed(2) >> split(3,3) # geographic
1096
+ one_of('30') >> split(3, 4) | # geographic
1097
+ one_of('20') >> split(4, 4) | # mobile
1098
+ fixed(2) >> split(3, 3) # geographic
1086
1099
 
1087
1100
  country '857', todo # Spare code
1088
1101
  country '858', todo # Spare code
@@ -1104,7 +1117,7 @@ Phony.define do
1104
1117
 
1105
1118
  # Global Mobile Satellite System (i.e. Iridium, Globalstar, etc)
1106
1119
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QM
1107
- country '881', fixed(1) >> split(3,5)
1120
+ country '881', fixed(1) >> split(3, 5)
1108
1121
 
1109
1122
  country '882', todo # International Networks, shared code
1110
1123
  country '883', todo # -
@@ -1130,58 +1143,59 @@ Phony.define do
1130
1143
 
1131
1144
  # Maldives (Republic of) http://www.wtng.info/wtng-960-mv.html, https://www.numberingplans.com
1132
1145
  country '960',
1133
- one_of(%w(800 900)) >> split(3,4) | # freephone, premium rate
1146
+ one_of(%w[800 900]) >> split(3, 4) | # freephone, premium rate
1134
1147
  fixed(3) >> split(4) # geographic, mobile
1135
1148
 
1136
1149
  # Lebanon
1137
1150
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1138
1151
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LB
1139
1152
  country '961',
1140
- one_of(%w(70 71 76 78 79)) >> split(3,3) | # mobile
1141
- one_of(%w(90 91)) >> split(3,3) | # premium rate
1142
- one_of(%w(80 81)) >> split(3,3) | # shared cost
1143
- one_of(%w(1 4 5 6 7 8 9)) >> split(3,3) | # geographic
1144
- one_of('3') >> split(3,3) | # mobile
1145
- fixed(1) >> split(3,3)
1153
+ one_of(%w[70 71 76 78 79]) >> split(3, 3) | # mobile
1154
+ one_of(%w[90 91]) >> split(3, 3) | # premium rate
1155
+ one_of(%w[80 81]) >> split(3, 3) | # shared cost
1156
+ one_of(%w[1 4 5 6 7 8 9]) >> split(3, 3) | # geographic
1157
+ one_of('3') >> split(3, 3) | # mobile
1158
+ fixed(1) >> split(3, 3)
1146
1159
 
1147
1160
  # Jordan (Hashemite Kingdom of)
1148
1161
  country '962',
1149
- one_of(%w(6250 8790)) >> split(4) | # wireless geographic
1150
- one_of(%w(800 801 802 803 804 805 806 807 808 809)) >> split(3,2) | # freephone
1151
- one_of('810') >> split(3,2) | # ISP
1152
- one_of('900') >> split(3,2) | # premium rate
1153
- one_of('70') >> split(3,3) | # universal access
1154
- one_of(%w(85 87)) >> split(3,3) | # shared cost
1155
- one_of(%w(2 3 5 6)) >> split(3,4) | # geographic
1156
- one_of('7') >> split(4,4) | # mobile, pager
1157
- fixed(1) >> split(3,4)
1162
+ one_of(%w[6250 8790]) >> split(4) | # wireless geographic
1163
+ one_of(%w[800 801 802 803 804 805 806 807 808 809]) >> split(3, 2) | # freephone
1164
+ one_of('810') >> split(3, 2) | # ISP
1165
+ one_of('900') >> split(3, 2) | # premium rate
1166
+ one_of('70') >> split(3, 3) | # universal access
1167
+ one_of(%w[85 87]) >> split(3, 3) | # shared cost
1168
+ one_of(%w[2 3 5 6]) >> split(3, 4) | # geographic
1169
+ one_of('7') >> split(4, 4) | # mobile, pager
1170
+ fixed(1) >> split(3, 4)
1158
1171
 
1159
1172
  # Syrian Arab Republic
1160
1173
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SY
1161
1174
  country '963',
1162
- one_of(%w(11 14 31 33)) >> split(3,4) |
1163
- one_of(%w(12 13 15 16 21 22 23 25 34 41 43 51 52 53)) >> split(3,3) |
1164
- one_of('4') >> split(3,4) |
1165
- one_of('9') >> split(4,4) | # mobile
1166
- fixed(2) >> split(3,3)
1175
+ one_of(%w[11 14 31 33]) >> split(3, 4) |
1176
+ one_of(%w[12 13 15 16 21 22 23 25 34 41 43 51 52 53]) >> split(3, 3) |
1177
+ one_of('4') >> split(3, 4) |
1178
+ one_of('9') >> split(4, 4) | # mobile
1179
+ fixed(2) >> split(3, 3)
1167
1180
 
1168
1181
  # Iraq (Republic of)
1169
1182
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1170
1183
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=IQ
1171
1184
  country '964',
1172
- one_of(%w(21 23 24 25 30 32 33 36 37 40 42 43 50 53 60 62 66)) >> split(3,3) |
1173
- one_of(%w(71 72 73 74 75 76 77 78 79)) >> split(4,4) | # mobile
1174
- one_of('1') >> split(3,4) |
1175
- fixed(2) >> split(3,3)
1185
+ one_of(%w[21 23 24 25 30 32 33 36 37 40 42 43 50 53 60 62 66]) >> split(3, 3) |
1186
+ one_of(%w[71 72 73 74 75 76 77 78 79]) >> split(4, 4) | # mobile
1187
+ one_of('1') >> split(3, 4) |
1188
+ fixed(2) >> split(3, 3)
1176
1189
 
1177
1190
  # Kuwait (State of) http://www.wtng.info/wtng-965-kw.html
1178
1191
  country '965',
1179
1192
  none >> matched_split(
1180
- /\A65816\d+\z/ => [4,4,4], # voicemail (mobile), Wataniya Telecom
1181
- /\A1\d+\z/ => [3,4], # geographic
1182
- /\A2\d+\z/ => [4,4], # geographic
1183
- /\A[569]\d+\z/ => [4,4], # mobile
1184
- /\A8\d+\z/ => [3,3], # geographic
1193
+ /\A65816\d+\z/ => [4, 4, 4], # voicemail (mobile), Wataniya Telecom
1194
+ /\A1\d+\z/ => [3, 4], # geographic
1195
+ /\A2\d+\z/ => [4, 4], # geographic
1196
+ /\A41\d+\z/ => [4, 4], # mobile (Virgin Mobile)
1197
+ /\A[569]\d+\z/ => [4, 4], # mobile
1198
+ /\A8\d+\z/ => [3, 3] # geographic
1185
1199
  )
1186
1200
 
1187
1201
  # country '966' # Saudi Arabia (Kingdom of), see special file.
@@ -1189,70 +1203,77 @@ Phony.define do
1189
1203
  # Yemen (Republic of)
1190
1204
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1191
1205
  country '967',
1192
- one_of(%w(70 71 73 77)) >> split(3,4) | # mobile
1206
+ one_of(%w[70 71 73 77]) >> split(3, 4) | # mobile
1193
1207
  one_of('58') >> split(4) | # pager
1194
1208
  one_of('1') >> matched_split(
1195
- /\A\d{6}\z/ => [3,3],
1196
- /\A\d+\z/ => [3,4]) |
1197
- one_of(%w(2 3 4 5 6 7)) >> split(3,3) |
1198
- fixed(1) >> split(3,3)
1209
+ /\A\d{6}\z/ => [3, 3],
1210
+ /\A\d+\z/ => [3, 4]
1211
+ ) |
1212
+ one_of(%w[2 3 4 5 6 7]) >> split(3, 3) |
1213
+ fixed(1) >> split(3, 3)
1199
1214
 
1200
1215
  # Oman (Sultanate of), https://www.numberingplans.com/?page=dialling&sub=areacodes
1201
- country '968', fixed(2) >> split(3,3)
1216
+ country '968', fixed(2) >> split(3, 3)
1202
1217
 
1203
1218
  reserved '969' # Reserved - reservation currently under investigation
1204
1219
 
1205
1220
  country '970', # 970 is used in those countries that block access to 972 (Israel)
1206
- one_of('1') >> split(3,3,3) | # special numbers
1207
- one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1208
- match(/^(5[023456789]|7[23467])\d+$/) >> split(3,4) # 2 digit ndc
1221
+ one_of('1') >> split(3, 3, 3) | # special numbers
1222
+ one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
1223
+ match(/^(5[023456789]|7[23467])\d+$/) >> split(3, 4) # 2 digit ndc
1209
1224
 
1210
1225
  # United Arab Emirates
1211
1226
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1212
1227
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=AE
1213
1228
  country '971',
1214
- one_of(%w(200 300)) >> split(3,3) | # shared cost
1215
- one_of('600') >> split(3,3) | # national rate
1216
- one_of(%w(500 700 900)) >> split(3,3) | # premium rate
1229
+ one_of(%w[200 300]) >> split(3, 3) | # shared cost
1230
+ one_of('600') >> split(3, 3) | # national rate
1231
+ one_of(%w[500 700 900]) >> split(3, 3) | # premium rate
1217
1232
  one_of('800') >> matched_split(
1218
- /\A\d{2}\z/ => [2],
1219
- /\A\d{7}\z/ => [2,3,2],
1220
- /\A\d+\z/ => [2,3,4]) | # freephone
1221
- one_of(%w(50 52 54 55 56 58)) >> split(3,4) | # mobile
1222
- one_of(%w(2 3 4 6 7 9)) >> split(3,4) |
1223
- fixed(1) >> split(3,4)
1233
+ /\A\d{2}\z/ => [2],
1234
+ /\A\d{7}\z/ => [2, 3, 2],
1235
+ /\A\d+\z/ => [2, 3, 4]
1236
+ ) | # freephone
1237
+ one_of(%w[50 52 54 55 56 58]) >> split(3, 4) | # mobile
1238
+ one_of(%w[2 3 4 6 7 9]) >> split(3, 4) |
1239
+ fixed(1) >> split(3, 4)
1224
1240
 
1225
1241
  # Israel (State of) (also works for numbers in Palestinian territories)
1226
1242
  country '972',
1227
- trunk('0') |
1228
- one_of('1') >> split(3,3,3) | # special numbers
1229
- one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1230
- match(/^(5[012345689]|7[234679])\d+$/) >> split(3,4) # 2 digit ndc
1243
+ trunk('0') |
1244
+ one_of('1') >> split(3, 3, 3) | # special numbers
1245
+ one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
1246
+ match(/^(5[012345689]|7[234679])\d+$/) >> split(3, 4) # 2 digit ndc
1231
1247
 
1232
- country '973', none >> split(4,4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
1248
+ country '973', none >> split(4, 4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
1233
1249
 
1234
1250
  # Qatar (State of)
1235
1251
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QA
1236
1252
  country '974',
1237
- one_of(%w(1245 1744)) >> split(3,3) | # voicemail
1238
- one_of(%w(800 900)) >> split(2,2) | # freephone, audiotext
1239
- one_of(%w(20 21 22 26)) >> split(3,2) | # pager
1240
- one_of(%w(92 97)) >> split(3) | # mobile
1241
- fixed(2) >> split(3,3)
1242
-
1243
- country '975', fixed(1) >> split(3, 3) # Bhutan (Kingdom of) http://www.wtng.info/wtng-975-bt.html
1253
+ one_of(%w[1245 1744]) >> split(3, 3) | # voicemail
1254
+ one_of(%w[800 900]) >> split(2, 2) | # freephone, audiotext
1255
+ one_of(%w[20 21 22 26]) >> split(3, 2) | # pager
1256
+ one_of(%w[92 97]) >> split(3) | # mobile
1257
+ fixed(2) >> split(3, 3)
1258
+
1259
+ # Bhutan (Kingdom of)
1260
+ # https://en.wikipedia.org/wiki/Telephone_numbers_in_Bhutan
1261
+ country '975',
1262
+ one_of(%w(16 17 77)) >> split(3, 3) | # Mobile
1263
+ one_of(%w(2)) >> split(3, 3) # Landline
1244
1264
 
1245
1265
  # Mongolia
1246
1266
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MN
1247
1267
  country '976',
1248
- one_of(%w(121 122 123 221 222 223)) >> matched_split(
1249
- /\A\d{4}\z/ => [2,2],
1250
- /\A\d+\z/ => [2,3]) |
1251
- one_of(%w(11 12 13 14 15 21 22 23 24 25)) >> split(3,2) |
1252
- one_of(%w(70 75 76 77 78 79)) >> split(3,3) | # VoIP telephony
1253
- one_of(%w(88 89 90 91 94 95 96 99)) >> split(3,3) | # mobile
1254
- one_of(%w(50 55 56 58 92)) >> split(3,3) | # wireless geographic
1255
- fixed(2) >> split(3,3)
1268
+ one_of(%w[121 122 123 221 222 223]) >> matched_split(
1269
+ /\A\d{4}\z/ => [2, 2],
1270
+ /\A\d+\z/ => [2, 3]
1271
+ ) |
1272
+ one_of(%w[11 12 13 14 15 21 22 23 24 25]) >> split(3, 2) |
1273
+ one_of(%w[70 75 76 77 78 79]) >> split(3, 3) | # VoIP telephony
1274
+ one_of(%w[88 89 90 91 94 95 96 99]) >> split(3, 3) | # mobile
1275
+ one_of(%w[50 55 56 58 92]) >> split(3, 3) | # wireless geographic
1276
+ fixed(2) >> split(3, 3)
1256
1277
 
1257
1278
  # country '977' # Nepal, see special file
1258
1279