phony 2.20.5 → 3.0.2

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 +93 -93
  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 -52
  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 -14
  45. data/lib/phony/countries/zimbabwe.rb +31 -31
  46. data/lib/phony/countries.rb +469 -447
  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 -674
  66. data/spec/lib/phony/countries_spec.rb +0 -1454
  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,78 @@ 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
+ fixed(1) >> split(3, 4) # Rest
281
279
 
282
280
  # Singapore (Republic of).
283
281
  #
282
+ # There is no trunk code for this country and some numbers start with 0.
284
283
  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
- )
284
+ trunk('', normalize: false) |
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
+ )
289
289
 
290
290
  # Thailand.
291
291
  #
292
292
  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
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
297
 
298
298
  # country '81' # Japan, see special file.
299
299
 
@@ -306,8 +306,8 @@ Phony.define do
306
306
  # Turkey.
307
307
  #
308
308
  country '90',
309
- trunk('0') |
310
- fixed(3) >> split(3,4) # Wiki says 7, but the examples say 3, 4.
309
+ trunk('0') |
310
+ fixed(3) >> split(3, 4) # Wiki says 7, but the examples say 3, 4.
311
311
 
312
312
  # country '91' # India (Republic of) see special file
313
313
 
@@ -317,39 +317,39 @@ Phony.define do
317
317
  #
318
318
  # From http://www.wtng.info/wtng-93-af.html
319
319
  #
320
- country '93', fixed(2) >> split(7) # Note: the document says 6, but the examples use 7.
320
+ country '93', fixed(2) >> split(7) # NOTE: the document says 6, but the examples use 7.
321
321
 
322
- country '94', # TODO Sri Lanka (Democratic Socialist Republic of)
323
- fixed(2) >> split(3,2,2)
322
+ country '94', # TODO: Sri Lanka (Democratic Socialist Republic of)
323
+ fixed(2) >> split(3, 2, 2)
324
324
 
325
- #country '95' # Myanmar, see special file.
325
+ # country '95' # Myanmar, see special file.
326
326
 
327
327
  country '98', # Iran (Islamic Republic of)
328
- one_of('21') >> split(4,4) | # Teheran
329
- fixed(3) >> split(3,4)
328
+ one_of('21') >> split(4, 4) | # Teheran
329
+ fixed(3) >> split(3, 4)
330
330
 
331
331
  country '210', todo # -
332
- country '211', fixed(3) >> split(3,3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
332
+ country '211', fixed(3) >> split(3, 3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
333
333
 
334
334
  country '212', # Morocco
335
- trunk('0') |
336
- one_of('6') >> split(2,2,2,2) | # mobile
337
- fixed(2) >> split(4,3)
335
+ trunk('0') |
336
+ one_of('6') >> split(2, 2, 2, 2) | # mobile
337
+ fixed(2) >> split(4, 3)
338
338
 
339
- country '213', fixed(2) >> split(3,4) # Algeria
339
+ country '213', fixed(2) >> split(3, 4) # Algeria
340
340
  country '214', todo # -
341
341
  country '215', todo # -
342
- country '216', fixed(1) >> split(3,4) # Tunisia
342
+ country '216', fixed(1) >> split(3, 4) # Tunisia
343
343
  country '217', todo # -
344
344
 
345
345
  # country '218' # Lybia, see special file
346
346
 
347
347
  country '219', todo # -
348
348
 
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
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
353
 
354
354
  # country '224' # Guinea, see special file
355
355
 
@@ -360,8 +360,8 @@ Phony.define do
360
360
  #
361
361
  # There is no trunk code for this country and several of the mobile prefixes start with 0
362
362
  country '225',
363
- trunk('', :normalize => false) |
364
- fixed(2) >> split(2,2,2,2)
363
+ trunk('', normalize: false) |
364
+ fixed(2) >> split(2, 2, 2, 2)
365
365
 
366
366
  # Burkina Faso
367
367
  # http://www.wtng.info/wtng-226-bf.html
@@ -369,25 +369,44 @@ Phony.define do
369
369
  #
370
370
  # There is no trunk code for this country and several of the mobile prefixes start with 0
371
371
  country '226',
372
- trunk('', normalize: false) |
373
- none >> split(2,2,2,2)
372
+ trunk('', normalize: false) |
373
+ none >> split(2, 2, 2, 2)
374
+
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
374
377
 
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
378
+ # Benin http://www.itu.int/oth/T0202000017/en
379
+ #
380
+ # There is no trunk code for this country and prefixes start with 0.
381
+ country '229',
382
+ trunk('', normalize: false) |
383
+ none >> matched_split(
384
+ # Old empty and new 01 prefix.
385
+ /\A(01)?\d+\z/ => [2, 2, 2, 2, 2]
386
+ )
378
387
 
379
- country '230', none >> split(4,4) # Mauritius http://www.wtng.info/wtng-230-mu.html
388
+ # Mauritius
389
+ # http://www.wtng.info/wtng-230-mu.html
390
+ # https://en.wikipedia.org/wiki/Telephone_numbers_in_Mauritius
391
+ #
392
+ # There is no trunk code for this country.
393
+ country '230',
394
+ none >> matched_split(
395
+ /^5\d{7}$/ => [1, 3, 4], # Mobile
396
+ /^[246]\d{6}$/ => [3, 4] # Landline
397
+ )
380
398
 
381
399
  # Liberia
382
400
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LR
383
401
  country '231',
384
- none >> matched_split(
385
- /\A[23]\d+\z/ => [4,4], # LIBTELCO, TEMAS
386
- /\A[4568]\d+\z/ => [4,3], # mobile Lonestar, Libercell, Comium Liberia Inc.
387
- /\A77\d+\z/ => [2,3,4], # http://monrovia.usembassy.gov/contact.html
388
- /\A7\d+\z/ => [4,4], # mobile Cellcom
389
- /\A9\d+\z/ => [4,4], # premium rate Telelinks International SAL, Interactive Media Corporation
390
- )
402
+ none >> matched_split(
403
+ /\A88\d{7}\z/ => [2, 3, 4], # mobile Lonestar Cell MTN
404
+ /\A[23]\d+\z/ => [4, 4], # LIBTELCO, TEMAS
405
+ /\A[4568]\d+\z/ => [4, 3], # mobile Lonestar, Libercell, Comium Liberia Inc.
406
+ /\A77\d+\z/ => [2, 3, 4], # http://monrovia.usembassy.gov/contact.html
407
+ /\A7\d+\z/ => [4, 4], # mobile Cellcom
408
+ /\A9\d+\z/ => [4, 4] # premium rate Telelinks International SAL, Interactive Media Corporation
409
+ )
391
410
 
392
411
  country '232', fixed(2) >> split(3, 3) # Sierra Leone http://www.wtng.info/wtng-232-sl.html
393
412
 
@@ -396,7 +415,7 @@ Phony.define do
396
415
  # From http://www.itu.int/oth/T0202000052/en
397
416
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Ghana
398
417
  #
399
- country '233', trunk('0') | fixed(2) >> split(3,4)
418
+ country '233', trunk('0') | fixed(2) >> split(3, 4)
400
419
 
401
420
  # Nigeria
402
421
  # 3 4 split for mobile and 1 digit NDC, 3 2 or 3 3 otherwise
@@ -406,46 +425,46 @@ Phony.define do
406
425
  # https://www.ncc.gov.ng/technical-regulation/standards/numbering and
407
426
  # https://www.itu.int/oth/T020200009C/en
408
427
  country '234',
409
- match(/^([7-9]0\d)\d+$/) >> split(3,4) | # Mobile
410
- match(/^(81\d)\d+$/) >> split(3,4) | # Mobile
411
- match(/^(91\d)\d+$/) >> split(3,4) | # Mobile
412
- one_of('1', '2') >> split(3,3..4) | # Lagos, Ibadan
413
- one_of('9') >> split(3,4) | # Abuja
414
- one_of((30..79).map(&:to_s)) >> split(3,2..3) | # 2-digit NDC
415
- one_of(%w(82 83 84 85 86 87 88 89)) >> split(3,3) # 2-digit NDC
416
-
417
- country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
418
- country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
419
- country '237', none >> split(3,2,2,2) # Cameroon http://www.wtng.info/wtng-237-cm.html
420
- country '238', none >> split(3,4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
421
- country '239', fixed(1) >> split(3,3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
422
-
423
- country '240', none >> split(3,3,3) # Equatorial Guinea
428
+ match(/^([7-9]0\d)\d+$/) >> split(3, 4) | # Mobile
429
+ match(/^(81\d)\d+$/) >> split(3, 4) | # Mobile
430
+ match(/^(91\d)\d+$/) >> split(3, 4) | # Mobile
431
+ one_of('1', '2') >> split(3, 3..4) | # Lagos, Ibadan
432
+ one_of('9') >> split(3, 4) | # Abuja
433
+ one_of((30..79).map(&:to_s)) >> split(3, 2..3) | # 2-digit NDC
434
+ one_of(%w[82 83 84 85 86 87 88 89]) >> split(3, 3) # 2-digit NDC
435
+
436
+ country '235', none >> split(4, 4) # Chad http://www.wtng.info/wtng-235-td.html
437
+ country '236', none >> split(4, 4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
438
+ country '237', none >> split(3, 2, 2, 2) # Cameroon http://www.wtng.info/wtng-237-cm.html
439
+ country '238', none >> split(3, 4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
440
+ country '239', fixed(1) >> split(3, 3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
441
+
442
+ country '240', none >> split(3, 3, 3) # Equatorial Guinea
424
443
  country '241',
425
- match(/^(\d)\d{6}$/) >> split(3,3) | # Gabonese Republic http://www.wtng.info/wtng-241-ga.html
426
- match(/^(\d\d)\d{6}$/) >> split(2,2,2) # 2019 update https://en.wikipedia.org/wiki/Telephone_numbers_in_Gabon
444
+ match(/^(\d)\d{6}$/) >> split(3, 3) | # Gabonese Republic http://www.wtng.info/wtng-241-ga.html
445
+ match(/^(\d\d)\d{6}$/) >> split(2, 2, 2) # 2019 update https://en.wikipedia.org/wiki/Telephone_numbers_in_Gabon
427
446
  country '242', # Congo http://www.wtng.info/wtng-242-cg.html
428
- trunk('', :normalize => false) |
429
- none >> split(4,5)
430
- country '243', fixed(2) >> split(3,4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
431
- 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
432
- fixed(2) >> split(3,4)
433
- country '245', none >> split(2,3,4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
434
- country '246', none >> split(3,4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
447
+ trunk('', normalize: false) |
448
+ none >> split(4, 5)
449
+ country '243', fixed(2) >> split(3, 4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
450
+ 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
451
+ fixed(2) >> split(3, 4)
452
+ country '245', none >> split(2, 3, 4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
453
+ country '246', none >> split(3, 4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
435
454
  country '247', none >> split(4) # Ascension
436
455
 
437
- country '248', # Seychelles
438
- fixed(1) >> split(2,2,2)
456
+ country '248', # Seychelles
457
+ fixed(1) >> split(2, 2, 2)
439
458
 
440
- country '249', fixed(2) >> split(3,4) # Sudan
459
+ country '249', fixed(2) >> split(3, 4) # Sudan
441
460
 
442
461
  # Rwanda
443
462
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
444
463
  country '250',
445
- trunk('0') |
446
- one_of('25') >> split(7) | # Geographic, fixed
447
- match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
448
- one_of('06') >> split(6) # Satellite
464
+ trunk('0') |
465
+ one_of('25') >> split(7) | # Geographic, fixed
466
+ match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
467
+ one_of('06') >> split(6) # Satellite
449
468
 
450
469
  country '251', fixed(2) >> split(3, 4) # Ethiopia http://www.wtng.info/wtng-251-et.html
451
470
 
@@ -456,40 +475,40 @@ Phony.define do
456
475
  # Kenya
457
476
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
458
477
  country '254',
459
- trunk('0') |
460
- match(/^(7\d\d)/) >> split(6) | # mobile
461
- fixed(2) >> split(7) # landline
478
+ trunk('0') |
479
+ match(/^(7\d\d)/) >> split(6) | # mobile
480
+ fixed(2) >> split(7) # landline
462
481
 
463
482
  # Tanzania.
464
483
  #
465
484
  country '255',
466
- trunk('0') |
467
- match(/^([89]\d\d)/) >> split(3,3) | # Special/Premium.
468
- one_of('112', '118') >> split(3,3) | # Short Codes.
469
- fixed(2) >> split(3,4) # Geographic.
485
+ trunk('0') |
486
+ match(/^([89]\d\d)/) >> split(3, 3) | # Special/Premium.
487
+ one_of('112', '118') >> split(3, 3) | # Short Codes.
488
+ fixed(2) >> split(3, 4) # Geographic.
470
489
 
471
490
  # Uganda.
472
491
  #
473
492
  country '256',
474
- match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
475
- fixed(2) >> split(7) # Geo 2.
493
+ match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
494
+ fixed(2) >> split(7) # Geo 2.
476
495
 
477
- country '257', none >> split(4,4) # Burundi http://www.wtng.info/wtng-257-bi.html
496
+ country '257', none >> split(4, 4) # Burundi http://www.wtng.info/wtng-257-bi.html
478
497
 
479
498
  # Mozambique, https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MZ
480
499
  country '258',
481
- one_of('600') >> split(3,3) | # audiotext
482
- one_of('610') >> split(3,3) | # ISP
483
- one_of('800') >> split(3,3) | # freephone
484
- one_of('801') >> split(3,3) | # local rate
485
- one_of('802') >> split(3,3) | # national rate
486
- one_of(%w(251 252 271 272 281 282 293)) >> split(3,2) |
487
- one_of(%w(21 23 24 26)) >> split(3,3) |
488
- one_of(%w(82 84 86)) >> split(4,3) | # mobile
489
- one_of('89') >> split(4,3) | # satellite GMPCS
490
- one_of('7') >> split(4,4) | # universal access
491
- one_of('9') >> split(4,4) | # premium rate
492
- fixed(2) >> split(3,3)
500
+ one_of('600') >> split(3, 3) | # audiotext
501
+ one_of('610') >> split(3, 3) | # ISP
502
+ one_of('800') >> split(3, 3) | # freephone
503
+ one_of('801') >> split(3, 3) | # local rate
504
+ one_of('802') >> split(3, 3) | # national rate
505
+ one_of(%w[251 252 271 272 281 282 293]) >> split(3, 2) |
506
+ one_of(%w[21 23 24 26]) >> split(3, 3) |
507
+ one_of(%w[82 83 84 85 86 87]) >> split(4, 3) | # mobile
508
+ one_of('89') >> split(4, 3) | # satellite GMPCS
509
+ one_of('7') >> split(4, 4) | # universal access
510
+ one_of('9') >> split(4, 4) | # premium rate
511
+ fixed(2) >> split(3, 3)
493
512
 
494
513
  country '259', todo # -
495
514
 
@@ -499,33 +518,26 @@ Phony.define do
499
518
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Zambia
500
519
 
501
520
  country '260',
502
- trunk('0') |
503
- match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
504
- match(/^(800)/) >> split(3,3) | # Toll free
505
- match(/^(21[1-8])/) >> split(6) # Fixed
521
+ trunk('0') |
522
+ match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
523
+ match(/^(800)/) >> split(3, 3) | # Toll free
524
+ match(/^(21[1-8])/) >> split(6) # Fixed
506
525
 
507
526
  # Madagascar
508
527
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Madagascar
509
528
  # http://www.itu.int/oth/T020200007F/en
510
529
  country '261',
511
- # none >> matched_split(
512
- # /\A20\d+\z/ => [2,2,3,2], # Telecom Malagasy (Telma)
513
- # /\A32\d+\z/ => [2,2,3,2], # mobile Orange Madagascar
514
- # /\A33\d+\z/ => [2,2,3,2], # mobile Airtel Madagascar
515
- # /\A34\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
516
- # /\A38\d+\z/ => [2,2,3,2], # mobile Telecom Malagasy (Telma)
517
- # /\A39\d+\z => [2,2,3,2] # mobile Blueline
518
- # ),
519
- match(/\A(20)\d+\z/) >> split(2,3,2) | # fix Telecom Malagasy (Telma)
520
- match(/\A(32)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
521
- match(/\A(33)\d+\z/) >> split(2,3,2) | # mobile Airtel Madagascar
522
- match(/\A(34)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
523
- match(/\A(38)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
524
- match(/\A(39)\d+\z/) >> split(2,3,2) # mobile Blueline Madagascar
530
+ match(/\A(20)\d+\z/) >> split(2, 3, 2) | # fix Telecom Malagasy (Telma)
531
+ match(/\A(32)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
532
+ match(/\A(33)\d+\z/) >> split(2, 3, 2) | # mobile Airtel Madagascar
533
+ match(/\A(34)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
534
+ match(/\A(37)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
535
+ match(/\A(38)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
536
+ match(/\A(39)\d+\z/) >> split(2, 3, 2) # mobile Blueline Madagascar
525
537
 
526
538
  country '262', # Reunion / Mayotte (new) http://www.wtng.info/wtng-262-fr.html
527
- trunk('0') |
528
- fixed(3) >> split(2,2,2)
539
+ trunk('0') |
540
+ fixed(3) >> split(2, 2, 2)
529
541
 
530
542
  # country '263' # Zimbabwe, see special file
531
543
 
@@ -535,10 +547,10 @@ Phony.define do
535
547
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MW
536
548
  country '265',
537
549
  none >> matched_split(
538
- /\A(21|77)\d+\z/ => [3,3,3], # geographic, mobile
539
- /\A(88|99)\d{7}\z/ => [3,3,3], # mobile
540
- /\A18(00|11|18|20)\z/ => [4], # ISP
541
- /\A\d+\z/ => [4,3]
550
+ /\A(21|77)\d+\z/ => [3, 3, 3], # geographic, mobile
551
+ /\A(88|99)\d{7}\z/ => [3, 3, 3], # mobile
552
+ /\A18(00|11|18|20)\z/ => [4], # ISP
553
+ /\A\d+\z/ => [4, 3]
542
554
  )
543
555
 
544
556
  country '266', none >> split(4, 4) # Lesotho http://www.wtng.info/wtng-266-ls.html
@@ -547,39 +559,39 @@ Phony.define do
547
559
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
548
560
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=BW
549
561
  country '267',
550
- one_of(%w(463 495 499 590)) >> split(4) |
551
- one_of(%w(24 26 29 31 46 47 49 53 54 57 58 59 62 65 68)) >> split(3,2) |
552
- one_of('79') >> split(3,3) | # VoIP telephony
553
- one_of('80') >> split(3,3) | # freephone
554
- one_of('90') >> split(3,3) | # premium rate
555
- one_of('7') >> split(4,3) | # moblie
556
- one_of('8') >> split(4,3) | # shared cost
557
- one_of('3') >> split(3,3) |
558
- fixed(2) >> split(3,2)
562
+ one_of(%w[463 495 499 590]) >> split(4) |
563
+ one_of(%w[24 26 29 31 46 47 49 53 54 57 58 59 62 65 68]) >> split(3, 2) |
564
+ one_of('79') >> split(3, 3) | # VoIP telephony
565
+ one_of('80') >> split(3, 3) | # freephone
566
+ one_of('90') >> split(3, 3) | # premium rate
567
+ one_of('7') >> split(4, 3) | # moblie
568
+ one_of('8') >> split(4, 3) | # shared cost
569
+ one_of('3') >> split(3, 3) |
570
+ fixed(2) >> split(3, 2)
559
571
 
560
572
  # Swaziland http://www.wtng.info/wtng-268-sz.html
561
573
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SZ
562
574
  country '268',
563
575
  none >> matched_split(
564
- /\A08\d+\z/ => [4,3], # freephone
565
- /\A(2200|2300|2538|2548)\d+\z/ => [4,4], # VoIP telephony Swaziland Posts and Telecommunications Corporation (SPTC)
566
- /\A(2400|76)\d+\z/ => [4,4], # mobile Swazi MTN Ltd
567
- /\A(2550|2551)\d+\z/ => [4,4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
568
- /\A(550|551)\d+\z/ => [3,4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
569
- /\A(22|23|24|25)\d+\z/ => [4,4], # geographic SPTC
570
- /\A77\d+\z/ => [4,4], # mobile Swaziland Posts and Telecommunications Corporation (SPTC) (CDMA)
571
- /\A78\d+\z/ => [4,4], # mobile Swazi MTN Ltd
576
+ /\A08\d+\z/ => [4, 3], # freephone
577
+ /\A(2200|2300|2538|2548)\d+\z/ => [4, 4], # VoIP telephony Swaziland Posts and Telecommunications Corporation (SPTC)
578
+ /\A(2400|76)\d+\z/ => [4, 4], # mobile Swazi MTN Ltd
579
+ /\A(2550|2551)\d+\z/ => [4, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
580
+ /\A(550|551)\d+\z/ => [3, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
581
+ /\A(22|23|24|25)\d+\z/ => [4, 4], # geographic SPTC
582
+ /\A77\d+\z/ => [4, 4], # mobile Swaziland Posts and Telecommunications Corporation (SPTC) (CDMA)
583
+ /\A78\d+\z/ => [4, 4] # mobile Swazi MTN Ltd
572
584
  )
573
585
 
574
586
  # Comoros http://www.wtng.info/wtng-269-km.html
575
587
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KM
576
588
  country '269',
577
589
  none >> matched_split(
578
- /\A800\d+\z/ => [4,3,3], # freephone Toll-free Global269
579
- /\A(763|77)\d+\z/ => [4,3], # geographic Comores Télécom
580
- /\A(32|33|34)\d+\z/ => [4,3], # mobile Comores Télécom (HURI)
581
- /\A(390|391|900|910)\d+\z/ => [4,3], # premium rate WIAIR SARL
582
- /\A(76)\d+\z/ => [4,3] # wireless geographic Comores Télécom
590
+ /\A800\d+\z/ => [4, 3, 3], # freephone Toll-free Global269
591
+ /\A(763|77)\d+\z/ => [4, 3], # geographic Comores Télécom
592
+ /\A(32|33|34)\d+\z/ => [4, 3], # mobile Comores Télécom (HURI)
593
+ /\A(390|391|900|910)\d+\z/ => [4, 3], # premium rate WIAIR SARL
594
+ /\A(76)\d+\z/ => [4, 3] # wireless geographic Comores Télécom
583
595
  )
584
596
 
585
597
  country '280', todo # -
@@ -609,20 +621,20 @@ Phony.define do
609
621
  # Faroe Islands http://www.wtng.info/wtng-298-fo.html
610
622
  country '298',
611
623
  none >> matched_split(
612
- /\A1\d+\z/ => [4], # universal access: Føroya Tele; ISP: Kall, Føroya Tele
613
- /\A\d+\z/ => [3,3]
624
+ /\A1\d+\z/ => [4], # universal access: Føroya Tele; ISP: Kall, Føroya Tele
625
+ /\A\d+\z/ => [3, 3]
614
626
  )
615
627
 
616
628
  # Greenland http://www.wtng.info/wtng-299-gl.html
617
629
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
618
630
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GL
619
631
  country '299',
620
- one_of(%w(199 691)) >> split(3) | # satellite; geographic: Ivittuut
621
- 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
622
- 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
623
- one_of(%w(38 39)) >> split(4) | # VoIP telephony
624
- match(/\A(50)\d{4}\z/) >> split(4) | #| voicemail (mobile) Tele Greenland A/S
625
- match(/\A(50)\d{6}\z/) >> split(3,3) | #|
632
+ one_of(%w[199 691]) >> split(3) | # satellite; geographic: Ivittuut
633
+ 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
634
+ 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
635
+ one_of(%w[38 39]) >> split(4) | # VoIP telephony
636
+ match(/\A(50)\d{4}\z/) >> split(4) | # | voicemail (mobile) Tele Greenland A/S
637
+ match(/\A(50)\d{6}\z/) >> split(3, 3) | # |
626
638
  fixed(2) >> split(4)
627
639
 
628
640
  # Gibraltar
@@ -634,36 +646,36 @@ Phony.define do
634
646
  # Portugal.
635
647
  #
636
648
  country '351',
637
- match(/^([78]\d\d)\d+$/) >> split(3,3) | # Service.
638
- match(/^(9\d)\d+$/) >> split(3,4) | # Mobile.
639
- one_of('21', '22') >> split(3,4) | # Lisboa & Porto
640
- fixed(3) >> split(3,3) # 3-digit NDCs
649
+ match(/^([78]\d\d)\d+$/) >> split(3, 3) | # Service.
650
+ match(/^(9\d)\d+$/) >> split(3, 4) | # Mobile.
651
+ one_of('21', '22') >> split(3, 4) | # Lisboa & Porto
652
+ fixed(3) >> split(3, 3) # 3-digit NDCs
641
653
 
642
654
  # Luxembourg
643
655
  #
644
656
  country '352',
645
- match(/^(2[467]\d{2})\d{4}$/) >> split(2,2) | # 4-digit NDC
646
- match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
647
- match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
648
- match(/^((2[^467]|[3-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
649
- match(/^((2[^467]|[3-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
650
- match(/^((2[^467]|[3-9]\d))\d{5}$/) >> split(2,2,1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
651
- match(/^((2[^467]|[3-9]\d))\d{6}$/) >> split(2,2,2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
652
- match(/^((2[^467]|[3-9]\d))\d{7}$/) >> split(2,2,3) | # 2-digit NDC Regular 6 digits with 4 digits extension
653
- match(/^((2[^467]|[3-9]\d))\d{8}$/) >> split(2,2,4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
654
- match(/^(\d{2})\d{3}$/) >> split(2,2,1) # fallback for 5 digit number
657
+ match(/^(2[467]\d{2})\d{4}$/) >> split(2, 2) | # 4-digit NDC
658
+ match(/^(6\d[18])\d+$/) >> split(3, 3) | # mobile
659
+ match(/^(60\d{2})\d{8}$/) >> split(2, 2, 2, 2) | # mobile machine to machine
660
+ match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
661
+ match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
662
+ match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2, 2, 1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
663
+ 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
664
+ match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2, 2, 3) | # 2-digit NDC Regular 6 digits with 4 digits extension
665
+ match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2, 2, 4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
666
+ match(/^(\d{2})\d{3}$/) >> split(2, 2, 1) # fallback for 5 digit number
655
667
 
656
668
  # country '353' # Republic of Ireland, see special file.
657
669
 
658
- country '354', none >> split(3,4) # Iceland
670
+ country '354', none >> split(3, 4) # Iceland
659
671
 
660
672
  # Albania
661
673
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Albania
662
674
  country '355', trunk('0') |
663
- one_of('4') >> split(3,4) | # Tirana
664
- match(/\A(6[6-9])\d*\z/) >> split(3,4) | # mobile
665
- match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3,3) |
666
- fixed(3) >> split(3,2)
675
+ one_of('4') >> split(3, 4) | # Tirana
676
+ match(/\A(6[6-9])\d*\z/) >> split(3, 4) | # mobile
677
+ match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3, 3) |
678
+ fixed(3) >> split(3, 2)
667
679
 
668
680
  # Malta
669
681
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Malta
@@ -675,8 +687,8 @@ Phony.define do
675
687
  # Cyprus
676
688
  # http://www.cytaglobal.com/cytaglobal/userfiles/NewNumberingPlan.pdf
677
689
  country '357', trunk('0') |
678
- one_of('121','122','123') >> split(2,6) | # voicemail
679
- fixed(2) >> split(6) # fixed & mobile
690
+ one_of('121', '122', '123') >> split(2, 6) | # voicemail
691
+ fixed(2) >> split(6) # fixed & mobile
680
692
 
681
693
  # Finland
682
694
  #
@@ -687,9 +699,9 @@ Phony.define do
687
699
  match(/^(73[0-4]\d\d)\d{5}$/) >> split(5) | # national subscriber numbers, 5-digit NDC (starting with 073)
688
700
  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
689
701
  match(/^(606\d|70[78]\d)\d{6}$/) >> split(3, 3) | # national service numbers, 4-digit NDCs (starting with 0606/0707/0708)
690
- match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) | # national subscriber numbers, 4-digit NDCs
702
+ match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) | # national subscriber numbers, 4-digit NDCs
691
703
  match(/^(45[45789]\d)\d{2,6}$/) >> split(2, 0..4) | # mobile numbers, 4-digit NDCs
692
- match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) | # national service numbers, 3-digit NDCs
704
+ match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) | # national service numbers, 3-digit NDCs
693
705
  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
694
706
  match(/^(71\d)\d{6}$/) >> split(3, 3) | # national subscriber numbers, 3-digit NDCs (starting with 071)
695
707
  match(/^(73[5-9])\d{7}$/) >> split(3, 4) | # national subscriber numbers, 3-digit NDCs (starting with 073)
@@ -697,8 +709,8 @@ Phony.define do
697
709
  match(/^(49\d)\d{8}$/) >> split(3, 3, 2) | # mobile numbers, 3-digit NDCs (starting with 049)
698
710
  match(/^([235]9)\d{6,8}$/) >> split(3, 3, 0..2) | # national subscriber numbers, 2-digit NDCs
699
711
  match(/^(4[0124678]|50)\d{4,8}$/) >> split(3, 1..5) | # mobile numbers, 2-digit NDCs
700
- one_of('2','3','5','6','8','9') >> split(3,1..5) | # Short NDCs
701
- fixed(2) >> split(3, 0..4) # 2-digit NDCs
712
+ one_of('2', '3', '5', '6', '8', '9') >> split(3, 1..5) | # Short NDCs
713
+ fixed(2) >> split(3, 0..4) # 2-digit NDCs
702
714
 
703
715
  # Bulgaria
704
716
  #
@@ -706,34 +718,30 @@ Phony.define do
706
718
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Bulgaria
707
719
  country '359',
708
720
  trunk('0') |
709
- match(/^(2)\d{6}$/) >> split(3,3) | # Landline Sofia (optional last digit)
710
- match(/^(2)\d{7}$/) >> split(3,4) | # Landline Sofia (optional last digit)
721
+ match(/^(2)\d{6}$/) >> split(3, 3) | # Landline Sofia (optional last digit)
722
+ match(/^(2)\d{7}$/) >> split(3, 4) | # Landline Sofia (optional last digit)
711
723
  match(/^(30|31|33|36|37|39|41|43\d|45|47|51|53|55|57|59)\d{5}$/) >> split(5) |
712
- 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) |
713
-
724
+ 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) |
714
725
  match(/^(60|61|63|65|66|69)\d{5}$/) >> split(5) |
715
726
  match(/^(60|61|62|63|64|65|66|68|69)\d{6}$/) >> split(6) |
716
-
717
727
  match(/^(700|701|703|704|705|706|707|708|709)\d{5}$/) >> split(5) |
718
728
  match(/^(701|702|703|704|705|706|707|708|709)\d{4}$/) >> split(4) |
719
-
720
729
  match(/^(71|72|74|75|77)\d{5}$/) >> split(5) |
721
730
  match(/^(71|72|73|74|75|76|77|78|79)\d{6}$/) >> split(6) |
722
-
723
731
  match(/^(80\d|81|91|93|95|97)\d{5}$/) >> split(5) |
724
732
  match(/^(81|82|84|86)\d{6}$/) >> split(6) |
725
- match(/^(87|88|89)\d{7}$/) >> split(4,3) |
733
+ match(/^(87|88|89)\d{7}$/) >> split(4, 3) |
726
734
  match(/^(90|91|92|93|94|95|96|97|98\d|99\d)\d{6}$/) >> split(6)
727
735
 
728
736
  # Lithuania
729
737
  #
730
738
  country '370',
731
739
  trunk('8', normalize: false) |
732
- one_of('700', '800') >> split(2,3) | # Service
733
- match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
734
- one_of('5') >> split(3,2,2) | # Vilnius
735
- one_of('37','41') >> split(2,2,2) | # Kaunas, Šiauliai
736
- fixed(3) >> split(1,2,2) # 3-digit NDCs.
740
+ one_of('700', '800') >> split(2, 3) | # Service
741
+ match(/^(6\d\d)\d+$/) >> split(2, 3) | # Mobile
742
+ one_of('5') >> split(3, 2, 2) | # Vilnius
743
+ one_of('37', '41') >> split(2, 2, 2) | # Kaunas, Šiauliai
744
+ fixed(3) >> split(1, 2, 2) # 3-digit NDCs.
737
745
 
738
746
  # country '371' # Latvia, see special file
739
747
 
@@ -742,7 +750,7 @@ Phony.define do
742
750
  country '372',
743
751
  match(/^(5\d\d\d)\d+$/) >> split(3..4) | # Mobile
744
752
  match(/^((?:70|8[12])\d\d)\d+$/) >> split(4) | # Mobile
745
- fixed(3) >> split(4) # 3-digit NDCs
753
+ fixed(3) >> split(4) # 3-digit NDCs
746
754
 
747
755
  # country '373' # Moldova, see special file
748
756
 
@@ -757,15 +765,15 @@ Phony.define do
757
765
  # Monaco
758
766
  #
759
767
  country '377',
760
- one_of('6') >> split(2,2,2,2) | # mobile
761
- fixed(2) >> split(2,2,2)
768
+ one_of('6') >> split(2, 2, 2, 2) | # mobile
769
+ fixed(2) >> split(2, 2, 2)
762
770
 
763
771
  # San Marino
764
772
  country '378',
765
- trunk('', :normalize => false) |
773
+ trunk('', normalize: false) |
766
774
  none >> matched_split(
767
- /\A\d{6}\z/ => [3,3],
768
- /\A\d+\z/ => [3,3,4]
775
+ /\A\d{6}\z/ => [3, 3],
776
+ /\A\d+\z/ => [3, 3, 4]
769
777
  )
770
778
 
771
779
  country '379', todo # Vatican City State
@@ -781,7 +789,7 @@ Phony.define do
781
789
  # Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Kosovo
782
790
  country '383',
783
791
  trunk('0') |
784
- fixed(2) >> split(3,3)
792
+ fixed(2) >> split(3, 3)
785
793
 
786
794
  country '384', todo # -
787
795
 
@@ -792,19 +800,26 @@ Phony.define do
792
800
  # http://en.wikipedia.org/wiki/Telephone_numbers_in_Slovenia
793
801
  country '386',
794
802
  trunk('0') |
795
- one_of('30','31','40','41','51','64','65','66','67','68','69','70','71') >> split(3,3) | # Mobile
796
- one_of('1','2','3','4','5','7') >> split(3,4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
797
- fixed(3) >> split(2,3) # catchall
803
+ one_of('30', '31', '40', '41', '51', '64', '65', '66', '67', '68', '69', '70', '71') >> split(3, 3) | # Mobile
804
+ one_of('1', '2', '3', '4', '5', '7') >> split(3, 4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
805
+ fixed(3) >> split(2, 3) # catchall
806
+
807
+ # Bosnia and Herzegovina
808
+ country '387',
809
+ trunk('0') |
810
+ match(/^(60)(?:31|32|33|34|38|39)/) >> split(7) | # BH Mobile
811
+ match(/^(64)(?:40|41|42|43|44|45)/) >> split(7) | # Haloo
812
+ match(/^(67)(?:11|12)/) >> split(7) | # Novotel
813
+ fixed(2) >> split(3, 3) # catchall
798
814
 
799
- country '387', trunk('0') | fixed(2) >> split(3,3) # Bosnia and Herzegovina
800
- country '388', trunk('0') | fixed(2) >> split(3,2,2) # Group of countries, shared code
815
+ country '388', trunk('0') | fixed(2) >> split(3, 2, 2) # Group of countries, shared code
801
816
 
802
817
  # The Former Yugoslav Republic of Macedonia
803
818
  country '389',
804
- trunk('0') |
805
- one_of('2','3','4','5','6','7','8') >> split(3,4)
819
+ trunk('0') |
820
+ one_of('2', '3', '4', '5', '6', '7', '8') >> split(3, 4)
806
821
 
807
- country '420', fixed(3) >> split(3,3) # Czech Republic
822
+ country '420', fixed(3) >> split(3, 3) # Czech Republic
808
823
 
809
824
  # Slovak Republic.
810
825
  #
@@ -815,7 +830,7 @@ Phony.define do
815
830
  fixed(2) >> split(7) # 2-digit NDCs
816
831
 
817
832
  country '422', todo # Spare code
818
- country '423', none >> split(3,2,2) # Liechtenstein (Principality of)
833
+ country '423', none >> split(3, 2, 2) # Liechtenstein (Principality of)
819
834
  country '424', todo # -
820
835
  country '425', todo # -
821
836
  country '426', todo # -
@@ -823,74 +838,75 @@ Phony.define do
823
838
  country '428', todo # -
824
839
  country '429', todo # -
825
840
 
826
- country '500', none >> split(2,3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
841
+ country '500', none >> split(2, 3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
827
842
  country '501', fixed(3) >> split(4) # Belize
828
843
 
829
844
  # Guatemala (Republic of) http://www.wtng.info/wtng-502-gt.html
830
845
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
831
846
  #
832
847
  country '502',
833
- one_of('19') >> split(3,3,3) | # premium rate
834
- fixed(1) >> split(3,4)
848
+ one_of('19') >> split(3, 3, 3) | # premium rate
849
+ fixed(1) >> split(3, 4)
835
850
 
836
- # El Salvador (Republic of)
851
+ # El Salvador (Republic of)
837
852
  country '503', fixed(4) >> split(4)
838
853
 
839
854
  # Honduras (Republic of) http://www.wtng.info/wtng-504-hn.html
840
855
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
841
856
  country '504',
842
- one_of('800') >> split(3,4) | # freephone
843
- fixed(2) >> split(3,3) # geographic, mobile
857
+ one_of('800') >> split(3, 4) | # freephone
858
+ fixed(2) >> split(3, 3) # geographic, mobile
844
859
 
845
860
  # Nicaragua http://www.wtng.info/wtng-505-ni.html
846
861
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
847
862
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=NI
848
863
  country '505',
849
- one_of('9') >> split(3,3) | # premium rate
850
- fixed(2) >> split(3,3) # geographic, mobile
864
+ one_of('9') >> split(3, 3) | # premium rate
865
+ fixed(2) >> split(3, 3) # geographic, mobile
851
866
 
852
867
  # Costa Rica http://www.wtng.info/wtng-506-cr.html
853
868
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
854
869
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=CR
855
870
  country '506',
856
- one_of('800') >> split(3,4) | # freephone
857
- one_of(%w(905 909)) >> split(3,4) | # premium rate
858
- fixed(1) >> split(3,4) # geographic
871
+ one_of('800') >> split(3, 4) | # freephone
872
+ one_of(%w[905 909]) >> split(3, 4) | # premium rate
873
+ fixed(1) >> split(3, 4) # geographic
859
874
 
860
875
  # Panama (Republic of) http://www.wtng.info/wtng-507-pa.html
861
876
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
862
877
  country '507',
863
- one_of(%w(800 809)) >> split(4) | # freephone
864
- one_of('6') >> split(3,4) | # mobile
865
- fixed(1) >> split(3,3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
878
+ one_of(%w[800 809]) >> split(4) | # freephone
879
+ one_of('6') >> split(3, 4) | # mobile
880
+ fixed(1) >> split(3, 3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
866
881
 
867
882
  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
868
883
 
869
884
  country '509', # Haiti (Republic of)
870
- fixed(2) >> split(2,4)
885
+ fixed(2) >> split(2, 4)
871
886
 
872
887
  # Guadeloupe (French Department of) http://www.wtng.info/wtng-590-fr.html
873
888
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
874
889
  country '590', trunk('0') |
875
- fixed(3) >> split(2,2,2)
890
+ fixed(3) >> split(2, 2, 2)
876
891
 
877
892
  country '591', # Bolivia (Republic of) http://www.itu.int/oth/T020200001A/en
878
- fixed(1) >> split(3,4)
893
+ fixed(1) >> split(3, 4)
879
894
 
880
895
  # Guyana http://www.wtng.info/wtng-592-gy.html
881
896
  # https://www.numberingplans.com
882
897
  country '592',
883
898
  one_of('10') >> split(2) | # audiotext
884
- one_of(%w(11 16 17 18 19)) >> split(3) | # audiotext
899
+ one_of(%w[11 16 17 18 19]) >> split(3) | # audiotext
885
900
  fixed(3) >> split(4) # geographic, audiotext
886
901
 
887
902
  # Ecuador http://www.wtng.info/wtng-593-ec.html
888
903
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=EC&current_page=1
889
904
  # https://en.wikipedia.org/wiki/Telephone_numbers_in_Ecuador
890
905
  country '593',
891
- one_of('9') >> split(4,4) |
892
- match(/\A([\d]{2})\d{7}\z/) >> split(3,4) |
893
- fixed(1) >> split(3,4)
906
+ match(/\A(1800)\d+\z/) >> split(3, 3) | # toll free 1800 numbers
907
+ one_of('9') >> split(4, 4) |
908
+ match(/\A([\d]{2})\d{7}\z/) >> split(3, 4) |
909
+ fixed(1) >> split(3, 4)
894
910
 
895
911
  country '594', fixed(3) >> split(3, 3) # French Guiana (French Department of) http://www.wtng.info/wtng-594-fr.html
896
912
 
@@ -898,25 +914,25 @@ Phony.define do
898
914
 
899
915
  # Martinique (French Department of) http://www.wtng.info/wtng-596-mq.html, https://www.numberingplans.com
900
916
  country '596', trunk('0') |
901
- fixed(3) >> split(2,2,2)
917
+ fixed(3) >> split(2, 2, 2)
902
918
 
903
919
  # Suriname (Republic of) http://www.wtng.info/wtng-597-sr.html, https://www.numberingplans.com
904
920
  country '597',
905
921
  none >> matched_split(
906
- /\A[6789]\d+\z/ => [3,4], # freephone, mobile
907
- /\A[2345]\d+\z/ => [3,3], # geographic, VoIP telephony
922
+ /\A[6789]\d+\z/ => [3, 4], # freephone, mobile
923
+ /\A[2345]\d+\z/ => [3, 3] # geographic, VoIP telephony
908
924
  )
909
925
 
910
926
  # country '598' # Uruguay (Eastern Republic of), see special file
911
927
 
912
- country '599', one_of('9') >> split(3,4) | # Netherlands Antilles (Curacao)
913
- fixed(3) >> split(4) # (other)
928
+ country '599', one_of('9') >> split(3, 4) | # Netherlands Antilles (Curacao)
929
+ fixed(3) >> split(4) # (other)
914
930
 
915
931
  # Democratic Republic of Timor-Leste http://www.wtng.info/wtng-670-tl.html
916
932
  country '670',
917
933
  none >> matched_split(
918
- /\A7\d+\z/ => [4,4], # mobile
919
- /\A\d+\z/ => [3,4]
934
+ /\A7\d+\z/ => [4, 4], # mobile
935
+ /\A\d+\z/ => [3, 4]
920
936
  )
921
937
 
922
938
  country '671', todo # Spare code
@@ -924,7 +940,7 @@ Phony.define do
924
940
  # Australian External Territories https://en.wikipedia.org/wiki/Telephone_numbers_in_Norfolk_Island
925
941
  # Norfolk Island
926
942
  country '672',
927
- fixed(1) >> split(2,3) |
943
+ fixed(1) >> split(2, 3) |
928
944
  match(/^(2\d+)$/) >> split(3) | # Fixed
929
945
  match(/^(5\d+)$/) >> split(3) # Mobile
930
946
 
@@ -934,56 +950,56 @@ Phony.define do
934
950
  # Papua New Guinea
935
951
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PG
936
952
  country '675',
937
- one_of(%w(180 181 182 183)) >> split(4) | # freephone
953
+ one_of(%w[180 181 182 183]) >> split(4) | # freephone
938
954
  one_of('170') >> split(2) | # mobile
939
955
  one_of('189') >> split(1) | # mobile
940
- one_of('184') >> split(4,4) | # ISP, PSDN X.28
941
- one_of(%w(185 270 271)) >> split(4) | # pager
942
- one_of(%w(275 276)) >> split(4) | # satellite
943
- one_of(%w(278 279)) >> split(2) | # satellite
944
- one_of('115') >> split(4,4) | # voicemail (mobile)
945
- one_of(%w(28 29)) >> split(3,2) | # pager
946
- one_of(%w(16 18)) >> split(3,2) | # ISP
947
- one_of(%w(70 71 72 74 75 76 78 79)) >> split(3,3) | # mobile
948
- one_of(%w(731 732 733 734 735 736 738 739)) >> split(2,3) | # mobile
949
- one_of(%w(770)) >> split(2,3) | # wireless geographic; Port Moresby, National Capital District
950
- one_of(%w(771)) >> split(2,3) | # wireless geographic; Momase region
951
- one_of(%w(772)) >> split(2,3) | # wireless geographic; Highlands region
952
- one_of(%w(7730)) >> split(1,3) | # wireless geographic; Southern region
953
- one_of(%w(774)) >> split(2,3) | # wireless geographic; Islands region
954
- one_of(%w(775)) >> split(2,3) | # mobile
955
- one_of(%w(80 81 82 83)) >> split(3,3) | # freephone
956
- one_of(%w(90 91 92 93)) >> split(3,3) | # geographic, ISDN
957
- one_of(%w(3 4 5 6 7 8 9)) >> split(3,3) # geographic
958
- fixed(1) >> split(3,3) # geographic
956
+ one_of('184') >> split(4, 4) | # ISP, PSDN X.28
957
+ one_of(%w[185 270 271]) >> split(4) | # pager
958
+ one_of(%w[275 276]) >> split(4) | # satellite
959
+ one_of(%w[278 279]) >> split(2) | # satellite
960
+ one_of('115') >> split(4, 4) | # voicemail (mobile)
961
+ one_of(%w[28 29]) >> split(3, 2) | # pager
962
+ one_of(%w[16 18]) >> split(3, 2) | # ISP
963
+ one_of(%w[70 71 72 74 75 76 78 79]) >> split(3, 3) | # mobile
964
+ one_of(%w[731 732 733 734 735 736 738 739]) >> split(2, 3) | # mobile
965
+ one_of(%w[770]) >> split(2, 3) | # wireless geographic; Port Moresby, National Capital District
966
+ one_of(%w[771]) >> split(2, 3) | # wireless geographic; Momase region
967
+ one_of(%w[772]) >> split(2, 3) | # wireless geographic; Highlands region
968
+ one_of(%w[7730]) >> split(1, 3) | # wireless geographic; Southern region
969
+ one_of(%w[774]) >> split(2, 3) | # wireless geographic; Islands region
970
+ one_of(%w[775]) >> split(2, 3) | # mobile
971
+ one_of(%w[80 81 82 83]) >> split(3, 3) | # freephone
972
+ one_of(%w[90 91 92 93]) >> split(3, 3) | # geographic, ISDN
973
+ one_of(%w[3 4 5 6 7 8 9]) >> split(3, 3) # geographic
974
+ fixed(1) >> split(3, 3) # geographic
959
975
 
960
976
  # Tonga (Kingdom of)
961
977
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=TO
962
978
  country '676',
963
979
  none >> matched_split(
964
- /\A(77|78|87|88|89)\d+\z/ => [2,3,2],
965
- /\A\d+\z/ => [2,3]
980
+ /\A(77|78|87|88|89)\d+\z/ => [2, 3, 2],
981
+ /\A\d+\z/ => [2, 3]
966
982
  )
967
983
 
968
984
  # Solomon Islands http://www.wtng.info/wtng-677-sb.html, https://www.numberingplans.com
969
985
  country '677',
970
986
  none >> matched_split(
971
- /\A7\d+\z/ => [4,3], # mobile
972
- /\A\d+\z/ => [2,3] # freephone, geographic, mobile, VoIP telephony
987
+ /\A7\d+\z/ => [4, 3], # mobile
988
+ /\A\d+\z/ => [2, 3] # freephone, geographic, mobile, VoIP telephony
973
989
  )
974
990
 
975
991
  # Vanuatu (Republic of) http://www.wtng.info/wtng-678-vu.html, https://www.numberingplans.com
976
992
  country '678',
977
993
  none >> matched_split(
978
- /\A[579]\d+\z/ => [4,3], # mobile
979
- /\A\d+\z/ => [2,3] # geographic, VoIP telephony
994
+ /\A[579]\d+\z/ => [4, 3], # mobile
995
+ /\A\d+\z/ => [2, 3] # geographic, VoIP telephony
980
996
  )
981
997
 
982
998
  country '679', none >> split(3, 4) # Fiji (Republic of) http://www.wtng.info/wtng-679-fj.html
983
999
 
984
1000
  country '680', none >> split(3, 4) # Palau (Republic of) http://www.wtng.info/wtng-680-pw.html
985
1001
  country '681', todo # Wallis and Futuna (Territoire français d'outre-mer)
986
- country '682', none >> split(2,3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
1002
+ country '682', none >> split(2, 3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
987
1003
  country '683', none >> split(4) # Niue http://www.wtng.info/wtng-683-nu.html
988
1004
  country '684', todo # -
989
1005
 
@@ -991,18 +1007,18 @@ Phony.define do
991
1007
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=WS
992
1008
  country '685',
993
1009
  none >> matched_split(
994
- /\A800\d+\z/ => [3,3], # freephone
995
- /\A830\d+\z/ => [3,3], # shared cost
996
- /\A60\d+\z/ => [3,3], # wireless geographic
997
- /\A(71|72|75|76|77)\d+\z/ => [3,4], # mobile
998
- /\A84\d+\z/ => [3,4], # wireless geographic
999
- /\A\d+\z/ => [2,3] # geographic
1010
+ /\A800\d+\z/ => [3, 3], # freephone
1011
+ /\A830\d+\z/ => [3, 3], # shared cost
1012
+ /\A60\d+\z/ => [3, 3], # wireless geographic
1013
+ /\A(71|72|75|76|77)\d+\z/ => [3, 4], # mobile
1014
+ /\A84\d+\z/ => [3, 4], # wireless geographic
1015
+ /\A\d+\z/ => [2, 3] # geographic
1000
1016
  )
1001
1017
 
1002
1018
  country '686', none >> split(8) # Kiribati (Republic of) https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KI
1003
- country '687', none >> split(3,3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
1019
+ country '687', none >> split(3, 3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
1004
1020
  country '688', none >> split(5) # Tuvalu http://www.wtng.info/wtng-688-tv.html
1005
- country '689', none >> split(2,2,2,2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
1021
+ country '689', none >> split(2, 2, 2, 2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
1006
1022
 
1007
1023
  country '690', fixed(1) >> split(3) # Tokelau http://www.wtng.info/wtng-690-tk.html
1008
1024
  country '691', none >> split(3, 4) # Micronesia (Federated States of) http://www.wtng.info/wtng-691-fm.html
@@ -1043,14 +1059,15 @@ Phony.define do
1043
1059
  # Democratic People's Republic of Korea
1044
1060
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KP
1045
1061
  country '850',
1046
- one_of(%w(191 192 193)) >> split(3,4) | # mobile
1062
+ one_of(%w[191 192 193]) >> split(3, 4) | # mobile
1047
1063
  one_of('2') >> matched_split(
1048
- /\A\d{5}\z/ => [3,2],
1049
- /\A\d{7}\z/ => [3,4],
1050
- #/\A(880|881|882|883|885)\d+\z/ => [4,4,4,4],
1051
- /\A\d+\z/ => [3,3,3]) |
1052
- one_of(%w(31 39 41 45 53 57 61 67 73 79)) >> split(3,3) |
1053
- fixed(2) >> split(3,3)
1064
+ /\A\d{5}\z/ => [3, 2],
1065
+ /\A\d{7}\z/ => [3, 4],
1066
+ # /\A(880|881|882|883|885)\d+\z/ => [4,4,4,4],
1067
+ /\A\d+\z/ => [3, 3, 3]
1068
+ ) |
1069
+ one_of(%w[31 39 41 45 53 57 61 67 73 79]) >> split(3, 3) |
1070
+ fixed(2) >> split(3, 3)
1054
1071
 
1055
1072
  country '851', todo # Spare code
1056
1073
 
@@ -1058,21 +1075,22 @@ Phony.define do
1058
1075
 
1059
1076
  country '852',
1060
1077
  match(/^(800)\d+$/) >> split(2, 4) |
1061
- none >> split(4,4)
1078
+ none >> split(4, 4)
1062
1079
 
1063
1080
  # Macao, China
1064
1081
  country '853', # Macao, China
1065
- match(/^(28)\d+$/) >> split(2,4) | # Landline.
1066
- match(/^(8)\d+$/) >> split(3,4) | # Landline.
1067
- match(/^(6)\d+$/) >> split(3,4) # Mobile.
1082
+ match(/^(28)\d+$/) >> split(2, 4) | # Landline.
1083
+ match(/^(8)\d+$/) >> split(3, 4) | # Landline.
1084
+ match(/^(6)\d+$/) >> split(3, 4) # Mobile.
1068
1085
 
1069
1086
  country '854', todo # Spare code
1070
1087
 
1071
1088
  # Lao People's Democratic Republic http://www.wtng.info/wtng-856-la.html, https://www.numberingplans.com
1072
1089
  country '856',
1073
- one_of('30') >> split(3,4) | # geographic
1074
- one_of('20') >> split(4,4) | # mobile
1075
- fixed(2) >> split(3,3) # geographic
1090
+ trunk('0') |
1091
+ one_of('30') >> split(3, 4) | # geographic
1092
+ one_of('20') >> split(4, 4) | # mobile
1093
+ fixed(2) >> split(3, 3) # geographic
1076
1094
 
1077
1095
  country '857', todo # Spare code
1078
1096
  country '858', todo # Spare code
@@ -1094,7 +1112,7 @@ Phony.define do
1094
1112
 
1095
1113
  # Global Mobile Satellite System (i.e. Iridium, Globalstar, etc)
1096
1114
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QM
1097
- country '881', fixed(1) >> split(3,5)
1115
+ country '881', fixed(1) >> split(3, 5)
1098
1116
 
1099
1117
  country '882', todo # International Networks, shared code
1100
1118
  country '883', todo # -
@@ -1120,58 +1138,59 @@ Phony.define do
1120
1138
 
1121
1139
  # Maldives (Republic of) http://www.wtng.info/wtng-960-mv.html, https://www.numberingplans.com
1122
1140
  country '960',
1123
- one_of(%w(800 900)) >> split(3,4) | # freephone, premium rate
1141
+ one_of(%w[800 900]) >> split(3, 4) | # freephone, premium rate
1124
1142
  fixed(3) >> split(4) # geographic, mobile
1125
1143
 
1126
1144
  # Lebanon
1127
1145
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1128
1146
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LB
1129
1147
  country '961',
1130
- one_of(%w(70 71 76 78 79)) >> split(3,3) | # mobile
1131
- one_of(%w(90 91)) >> split(3,3) | # premium rate
1132
- one_of(%w(80 81)) >> split(3,3) | # shared cost
1133
- one_of(%w(1 4 5 6 7 8 9)) >> split(3,3) | # geographic
1134
- one_of('3') >> split(3,3) | # mobile
1135
- fixed(1) >> split(3,3)
1148
+ one_of(%w[70 71 76 78 79]) >> split(3, 3) | # mobile
1149
+ one_of(%w[90 91]) >> split(3, 3) | # premium rate
1150
+ one_of(%w[80 81]) >> split(3, 3) | # shared cost
1151
+ one_of(%w[1 4 5 6 7 8 9]) >> split(3, 3) | # geographic
1152
+ one_of('3') >> split(3, 3) | # mobile
1153
+ fixed(1) >> split(3, 3)
1136
1154
 
1137
1155
  # Jordan (Hashemite Kingdom of)
1138
1156
  country '962',
1139
- one_of(%w(6250 8790)) >> split(4) | # wireless geographic
1140
- one_of(%w(800 801 802 803 804 805 806 807 808 809)) >> split(3,2) | # freephone
1141
- one_of('810') >> split(3,2) | # ISP
1142
- one_of('900') >> split(3,2) | # premium rate
1143
- one_of('70') >> split(3,3) | # universal access
1144
- one_of(%w(85 87)) >> split(3,3) | # shared cost
1145
- one_of(%w(2 3 5 6)) >> split(3,4) | # geographic
1146
- one_of('7') >> split(4,4) | # mobile, pager
1147
- fixed(1) >> split(3,4)
1157
+ one_of(%w[6250 8790]) >> split(4) | # wireless geographic
1158
+ one_of(%w[800 801 802 803 804 805 806 807 808 809]) >> split(3, 2) | # freephone
1159
+ one_of('810') >> split(3, 2) | # ISP
1160
+ one_of('900') >> split(3, 2) | # premium rate
1161
+ one_of('70') >> split(3, 3) | # universal access
1162
+ one_of(%w[85 87]) >> split(3, 3) | # shared cost
1163
+ one_of(%w[2 3 5 6]) >> split(3, 4) | # geographic
1164
+ one_of('7') >> split(4, 4) | # mobile, pager
1165
+ fixed(1) >> split(3, 4)
1148
1166
 
1149
1167
  # Syrian Arab Republic
1150
1168
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SY
1151
1169
  country '963',
1152
- one_of(%w(11 14 31 33)) >> split(3,4) |
1153
- one_of(%w(12 13 15 16 21 22 23 25 34 41 43 51 52 53)) >> split(3,3) |
1154
- one_of('4') >> split(3,4) |
1155
- one_of('9') >> split(4,4) | # mobile
1156
- fixed(2) >> split(3,3)
1170
+ one_of(%w[11 14 31 33]) >> split(3, 4) |
1171
+ one_of(%w[12 13 15 16 21 22 23 25 34 41 43 51 52 53]) >> split(3, 3) |
1172
+ one_of('4') >> split(3, 4) |
1173
+ one_of('9') >> split(4, 4) | # mobile
1174
+ fixed(2) >> split(3, 3)
1157
1175
 
1158
1176
  # Iraq (Republic of)
1159
1177
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1160
1178
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=IQ
1161
1179
  country '964',
1162
- one_of(%w(21 23 24 25 30 32 33 36 37 40 42 43 50 53 60 62 66)) >> split(3,3) |
1163
- one_of(%w(71 72 73 74 75 76 77 78 79)) >> split(4,4) | # mobile
1164
- one_of('1') >> split(3,4) |
1165
- fixed(2) >> split(3,3)
1180
+ one_of(%w[21 23 24 25 30 32 33 36 37 40 42 43 50 53 60 62 66]) >> split(3, 3) |
1181
+ one_of(%w[71 72 73 74 75 76 77 78 79]) >> split(4, 4) | # mobile
1182
+ one_of('1') >> split(3, 4) |
1183
+ fixed(2) >> split(3, 3)
1166
1184
 
1167
1185
  # Kuwait (State of) http://www.wtng.info/wtng-965-kw.html
1168
1186
  country '965',
1169
1187
  none >> matched_split(
1170
- /\A65816\d+\z/ => [4,4,4], # voicemail (mobile), Wataniya Telecom
1171
- /\A1\d+\z/ => [3,4], # geographic
1172
- /\A2\d+\z/ => [4,4], # geographic
1173
- /\A[569]\d+\z/ => [4,4], # mobile
1174
- /\A8\d+\z/ => [3,3], # geographic
1188
+ /\A65816\d+\z/ => [4, 4, 4], # voicemail (mobile), Wataniya Telecom
1189
+ /\A1\d+\z/ => [3, 4], # geographic
1190
+ /\A2\d+\z/ => [4, 4], # geographic
1191
+ /\A41\d+\z/ => [4, 4], # mobile (Virgin Mobile)
1192
+ /\A[569]\d+\z/ => [4, 4], # mobile
1193
+ /\A8\d+\z/ => [3, 3] # geographic
1175
1194
  )
1176
1195
 
1177
1196
  # country '966' # Saudi Arabia (Kingdom of), see special file.
@@ -1179,70 +1198,73 @@ Phony.define do
1179
1198
  # Yemen (Republic of)
1180
1199
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1181
1200
  country '967',
1182
- one_of(%w(70 71 73 77)) >> split(3,4) | # mobile
1201
+ one_of(%w[70 71 73 77]) >> split(3, 4) | # mobile
1183
1202
  one_of('58') >> split(4) | # pager
1184
1203
  one_of('1') >> matched_split(
1185
- /\A\d{6}\z/ => [3,3],
1186
- /\A\d+\z/ => [3,4]) |
1187
- one_of(%w(2 3 4 5 6 7)) >> split(3,3) |
1188
- fixed(1) >> split(3,3)
1204
+ /\A\d{6}\z/ => [3, 3],
1205
+ /\A\d+\z/ => [3, 4]
1206
+ ) |
1207
+ one_of(%w[2 3 4 5 6 7]) >> split(3, 3) |
1208
+ fixed(1) >> split(3, 3)
1189
1209
 
1190
1210
  # Oman (Sultanate of), https://www.numberingplans.com/?page=dialling&sub=areacodes
1191
- country '968', fixed(2) >> split(3,3)
1211
+ country '968', fixed(2) >> split(3, 3)
1192
1212
 
1193
1213
  reserved '969' # Reserved - reservation currently under investigation
1194
1214
 
1195
1215
  country '970', # 970 is used in those countries that block access to 972 (Israel)
1196
- one_of('1') >> split(3,3,3) | # special numbers
1197
- one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1198
- match(/^(5[023456789]|7[23467])\d+$/) >> split(3,4) # 2 digit ndc
1216
+ one_of('1') >> split(3, 3, 3) | # special numbers
1217
+ one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
1218
+ match(/^(5[023456789]|7[23467])\d+$/) >> split(3, 4) # 2 digit ndc
1199
1219
 
1200
1220
  # United Arab Emirates
1201
1221
  # https://www.numberingplans.com/?page=dialling&sub=areacodes
1202
1222
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=AE
1203
1223
  country '971',
1204
- one_of(%w(200 300)) >> split(3,3) | # shared cost
1205
- one_of('600') >> split(3,3) | # national rate
1206
- one_of(%w(500 700 900)) >> split(3,3) | # premium rate
1224
+ one_of(%w[200 300]) >> split(3, 3) | # shared cost
1225
+ one_of('600') >> split(3, 3) | # national rate
1226
+ one_of(%w[500 700 900]) >> split(3, 3) | # premium rate
1207
1227
  one_of('800') >> matched_split(
1208
- /\A\d{2}\z/ => [2],
1209
- /\A\d{7}\z/ => [2,3,2],
1210
- /\A\d+\z/ => [2,3,4]) | # freephone
1211
- one_of(%w(50 52 54 55 56 58)) >> split(3,4) | # mobile
1212
- one_of(%w(2 3 4 6 7 9)) >> split(3,4) |
1213
- fixed(1) >> split(3,4)
1228
+ /\A\d{2}\z/ => [2],
1229
+ /\A\d{7}\z/ => [2, 3, 2],
1230
+ /\A\d+\z/ => [2, 3, 4]
1231
+ ) | # freephone
1232
+ one_of(%w[50 52 54 55 56 58]) >> split(3, 4) | # mobile
1233
+ one_of(%w[2 3 4 6 7 9]) >> split(3, 4) |
1234
+ fixed(1) >> split(3, 4)
1214
1235
 
1215
1236
  # Israel (State of) (also works for numbers in Palestinian territories)
1216
1237
  country '972',
1217
- trunk('0') |
1218
- one_of('1') >> split(3,3,3) | # special numbers
1219
- one_of('2', '3', '4', '8', '9') >> split(3,4) | # 1 digit ndc
1220
- match(/^(5[012345689]|7[234679])\d+$/) >> split(3,4) # 2 digit ndc
1238
+ trunk('0') |
1239
+ one_of('1') >> split(3, 3, 3) | # special numbers
1240
+ one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
1241
+ match(/^(5[012345689]|7[234679])\d+$/) >> split(3, 4) # 2 digit ndc
1221
1242
 
1222
- country '973', none >> split(4,4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
1243
+ country '973', none >> split(4, 4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
1223
1244
 
1224
1245
  # Qatar (State of)
1225
1246
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QA
1226
1247
  country '974',
1227
- one_of(%w(1245 1744)) >> split(3,3) | # voicemail
1228
- one_of(%w(800 900)) >> split(2,2) | # freephone, audiotext
1229
- one_of(%w(20 21 22 26)) >> split(3,2) | # pager
1230
- one_of(%w(92 97)) >> split(3) | # mobile
1231
- fixed(2) >> split(3,3)
1248
+ one_of(%w[1245 1744]) >> split(3, 3) | # voicemail
1249
+ one_of(%w[800 900]) >> split(2, 2) | # freephone, audiotext
1250
+ one_of(%w[20 21 22 26]) >> split(3, 2) | # pager
1251
+ one_of(%w[92 97]) >> split(3) | # mobile
1252
+ fixed(2) >> split(3, 3)
1232
1253
 
1233
1254
  country '975', fixed(1) >> split(3, 3) # Bhutan (Kingdom of) http://www.wtng.info/wtng-975-bt.html
1234
1255
 
1235
1256
  # Mongolia
1236
1257
  # https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MN
1237
1258
  country '976',
1238
- one_of(%w(121 122 123 221 222 223)) >> matched_split(
1239
- /\A\d{4}\z/ => [2,2],
1240
- /\A\d+\z/ => [2,3]) |
1241
- one_of(%w(11 12 13 14 15 21 22 23 24 25)) >> split(3,2) |
1242
- one_of(%w(70 75 76 77 78 79)) >> split(3,3) | # VoIP telephony
1243
- one_of(%w(88 89 90 91 94 95 96 99)) >> split(3,3) | # mobile
1244
- one_of(%w(50 55 56 58 92)) >> split(3,3) | # wireless geographic
1245
- fixed(2) >> split(3,3)
1259
+ one_of(%w[121 122 123 221 222 223]) >> matched_split(
1260
+ /\A\d{4}\z/ => [2, 2],
1261
+ /\A\d+\z/ => [2, 3]
1262
+ ) |
1263
+ one_of(%w[11 12 13 14 15 21 22 23 24 25]) >> split(3, 2) |
1264
+ one_of(%w[70 75 76 77 78 79]) >> split(3, 3) | # VoIP telephony
1265
+ one_of(%w[88 89 90 91 94 95 96 99]) >> split(3, 3) | # mobile
1266
+ one_of(%w[50 55 56 58 92]) >> split(3, 3) | # wireless geographic
1267
+ fixed(2) >> split(3, 3)
1246
1268
 
1247
1269
  # country '977' # Nepal, see special file
1248
1270