phony 1.9.0 → 2.19.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/README.textile +64 -112
  3. data/lib/phony/config.rb +91 -0
  4. data/lib/phony/countries/argentina.rb +355 -0
  5. data/lib/phony/countries/austria.rb +56 -22
  6. data/lib/phony/countries/bangladesh.rb +57 -0
  7. data/lib/phony/countries/belarus.rb +133 -0
  8. data/lib/phony/countries/brazil.rb +101 -95
  9. data/lib/phony/countries/cambodia.rb +131 -0
  10. data/lib/phony/countries/china.rb +13 -6
  11. data/lib/phony/countries/croatia.rb +23 -0
  12. data/lib/phony/countries/georgia.rb +94 -0
  13. data/lib/phony/countries/germany.rb +66 -42
  14. data/lib/phony/countries/guinea.rb +46 -0
  15. data/lib/phony/countries/india.rb +50 -0
  16. data/lib/phony/countries/indonesia.rb +55 -0
  17. data/lib/phony/countries/ireland.rb +35 -28
  18. data/lib/phony/countries/italy.rb +272 -166
  19. data/lib/phony/countries/japan.rb +468 -0
  20. data/lib/phony/countries/kyrgyzstan.rb +120 -0
  21. data/lib/phony/countries/latvia.rb +43 -0
  22. data/lib/phony/countries/libya.rb +116 -0
  23. data/lib/phony/countries/malaysia.rb +31 -7
  24. data/lib/phony/countries/moldova.rb +53 -0
  25. data/lib/phony/countries/montenegro.rb +30 -0
  26. data/lib/phony/countries/myanmar.rb +55 -0
  27. data/lib/phony/countries/namibia.rb +37 -0
  28. data/lib/phony/countries/nepal.rb +73 -0
  29. data/lib/phony/countries/netherlands.rb +17 -5
  30. data/lib/phony/countries/pakistan.rb +121 -0
  31. data/lib/phony/countries/paraguay.rb +147 -0
  32. data/lib/phony/countries/{russia_kazakhstan_abhasia_south_osetia.rb → russia_kazakhstan_abkhasia_south_ossetia.rb} +35 -24
  33. data/lib/phony/countries/saudi_arabia.rb +40 -0
  34. data/lib/phony/countries/serbia.rb +47 -0
  35. data/lib/phony/countries/somalia.rb +26 -0
  36. data/lib/phony/countries/south_korea.rb +19 -10
  37. data/lib/phony/countries/sweden.rb +58 -38
  38. data/lib/phony/countries/taiwan.rb +28 -0
  39. data/lib/phony/countries/tajikistan.rb +79 -0
  40. data/lib/phony/countries/turkmenistan.rb +76 -0
  41. data/lib/phony/countries/ukraine.rb +630 -0
  42. data/lib/phony/countries/united_kingdom.rb +639 -44
  43. data/lib/phony/countries/uruguay.rb +53 -0
  44. data/lib/phony/countries/vietnam.rb +133 -0
  45. data/lib/phony/countries/zimbabwe.rb +39 -0
  46. data/lib/phony/countries.rb +901 -301
  47. data/lib/phony/country.rb +177 -20
  48. data/lib/phony/country_codes.rb +119 -101
  49. data/lib/phony/dsl.rb +113 -68
  50. data/lib/phony/local_splitters/fixed.rb +25 -1
  51. data/lib/phony/local_splitters/regex.rb +16 -2
  52. data/lib/phony/national_code.rb +7 -7
  53. data/lib/phony/national_splitters/default.rb +35 -3
  54. data/lib/phony/national_splitters/dsl.rb +12 -7
  55. data/lib/phony/national_splitters/fixed.rb +7 -1
  56. data/lib/phony/national_splitters/none.rb +7 -3
  57. data/lib/phony/national_splitters/regex.rb +6 -0
  58. data/lib/phony/national_splitters/variable.rb +13 -9
  59. data/lib/phony/trunk_code.rb +57 -0
  60. data/lib/phony/vanity.rb +3 -3
  61. data/lib/phony.rb +239 -55
  62. data/spec/functional/config_spec.rb +44 -0
  63. data/spec/functional/plausibility_spec.rb +656 -0
  64. data/spec/lib/phony/countries_spec.rb +1207 -119
  65. data/spec/lib/phony/country_codes_spec.rb +99 -81
  66. data/spec/lib/phony/country_spec.rb +54 -14
  67. data/spec/lib/phony/dsl_spec.rb +2 -2
  68. data/spec/lib/phony/local_splitters/fixed_spec.rb +4 -4
  69. data/spec/lib/phony/local_splitters/regex_spec.rb +50 -2
  70. data/spec/lib/phony/national_code_spec.rb +34 -34
  71. data/spec/lib/phony/national_splitters/default_spec.rb +34 -0
  72. data/spec/lib/phony/national_splitters/fixed_spec.rb +12 -6
  73. data/spec/lib/phony/national_splitters/none_spec.rb +13 -3
  74. data/spec/lib/phony/national_splitters/regex_spec.rb +1 -1
  75. data/spec/lib/phony/national_splitters/variable_spec.rb +11 -5
  76. data/spec/lib/phony/trunk_code_spec.rb +85 -0
  77. data/spec/lib/phony/vanity_spec.rb +15 -19
  78. data/spec/lib/phony_spec.rb +59 -277
  79. metadata +67 -34
  80. data/lib/phony/validator.rb +0 -26
  81. data/lib/phony/validators.rb +0 -88
  82. data/spec/lib/phony/validations_spec.rb +0 -109
@@ -1,7 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The United Kingdom uses a variable-length NDC code,
2
4
  # thus we use a separate file to not let countries.rb explode.
3
5
  #
4
6
  # Note: The United Kingdom uses a variable NDC format from length 2 to 5.
7
+ # Most UK numbers have ten digits but a few have only nine digits.
8
+ # http://www.aa-asterisk.org.uk/index.php/Category:UK_Number_Plan
5
9
  #
6
10
  # The UK is special in formatting in that it uses:
7
11
  # a 2-4-4 formatting rule with area codes that are 2 digits long,
@@ -11,20 +15,30 @@
11
15
  # There can be a mix of number lengths within a single area code.
12
16
  #
13
17
 
18
+ mobile_ndc = [
19
+ # Mobile [4+6].
20
+ #
21
+ # NOTE We're explicitly denoting this as dynamic strings cannot be frozen.
22
+ *%w(7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599),
23
+ '7624', # Isle of Man
24
+ *%w(7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999)
25
+ ]
26
+
14
27
  two_digit_ndc = [
15
- # Geographic [2+8].
28
+ # Geographic [2+8] - includes (02x) 0 and (02x) 1 as NDO.
16
29
  #
17
- '20', # London
18
- '23', # Southampton, Portsmith
19
- '24', # Coventry
20
- '28', # Northern Ireland
21
- '29', # Cardiff
30
+ '20', # London - (020) 3, (020) 7, (020) 8
31
+ '23', # Southampton - (023) 8, Portsmouth - (023) 9
32
+ '24', # Coventry - (024) 7
33
+ '28', # Northern Ireland - (028) but not (028) 5
34
+ '29', # Cardiff - (029) 2
22
35
 
23
36
  # Non-geographic [2+8].
24
37
  #
25
38
  '55', # Corporate
26
39
  '56', # LIECS/VoIP
27
40
  '70', # Personal numbers
41
+ '76', # Pagers (not 7624, Mobile, Isle of Man)
28
42
  ]
29
43
 
30
44
  # three_digit_ndc_with_nine_digits
@@ -34,7 +48,7 @@ two_digit_ndc = [
34
48
  # '800', # Freephone (9 digits) handled in specific rule, see below.
35
49
 
36
50
  three_digit_ndc = [
37
- # Geographic [3+7].
51
+ # Geographic [3+7] - includes (01xx) 0 and (01xx) 1 as NDO.
38
52
  #
39
53
  '113', # Leeds
40
54
  '114', # Sheffield
@@ -47,18 +61,20 @@ three_digit_ndc = [
47
61
  '141', # Glasgow
48
62
  '151', # Liverpool
49
63
  '161', # Manchester
50
- '191', # Tyne and Wear/County Durham
64
+ '191', # Tyneside, Sunderland and Durham (ELNS area)
51
65
 
52
- # Services [3+7].
66
+ # Non-geographic [3+7].
53
67
  #
54
- '300', # Non-geographic charged at same rate as 01
68
+ '300', # Non-geographic numbers (NTS) charged at geographic rates.
55
69
  '301',
70
+ '302',
56
71
  '303',
57
72
  '306',
58
73
  '308',
59
74
  '309',
60
75
  '330',
61
76
  '331',
77
+ '332',
62
78
  '333',
63
79
  '336',
64
80
  '339',
@@ -74,17 +90,17 @@ three_digit_ndc = [
74
90
  '800', # Freephone (10 digits) # 9 digits handled in specific rule, see below.
75
91
  '808', # Freephone (10 digits)
76
92
 
77
- '842', # Business rate [3+7].
93
+ '842', # Non-geographic numbers (NTS) with Service Charge up to 7p/min [3+7].
78
94
  '843',
79
95
  '844',
80
96
  '845',
81
- '870',
82
97
 
83
- '871', # Premium rate [3+7].
98
+ '870', # Non-geographic numbers (NTS) with Service Charge up to 13p/min [3+7].
99
+ '871',
84
100
  '872',
85
101
  '873',
86
102
 
87
- '900', # Premium rate content services [3+7].
103
+ '900', # Premium Rate Services (PRS) with Service Charge up to 300p/min [3+7].
88
104
  '901',
89
105
  '902',
90
106
  '903',
@@ -92,20 +108,34 @@ three_digit_ndc = [
92
108
  '905',
93
109
  '906',
94
110
  '907',
111
+ '910',
112
+ '911',
113
+ '912',
114
+ '913',
115
+ '914',
116
+ '915',
117
+ '916',
118
+ '917',
119
+ '918',
120
+ '919',
95
121
 
96
- '908', # Sexual entertainment services [3+7].
122
+ '908', # Sexual Entertainment Services (SES) with Service Charge up to 300p/min [3+7].
97
123
  '909',
124
+ '981',
98
125
  '982',
126
+ '983',
127
+ '984',
128
+ '989',
99
129
  ]
100
130
 
101
131
  # five_digit_ndc_with_nine_digits
102
- # Geographic [5+4].
132
+ # Geographic [5+4] - includes (016977) 0 and (016977) 1 as NDO.
103
133
  #
104
134
  # '16977', # Brampton (contains both 4 and 5 digit numbers)
105
135
  # # 9 digits handled in specific rule, see below.
106
136
 
107
137
  five_digit_ndc = [
108
- # Geographic [5+5].
138
+ # Geographic [5+5] - includes (01xxxx) 0 and (01xxxx) 1 as NDO.
109
139
  #
110
140
  # These areas use 5-5 format. One area has some 5-4 numbers too (see above).
111
141
  # They share their initial digits with area codes using 4-6 (and 4-5).
@@ -123,10 +153,10 @@ five_digit_ndc = [
123
153
  '19467', # Gosforth
124
154
  ]
125
155
 
126
- no_split = [
127
- # Geographic [4+6]/[4+5].
156
+ variable_length_number = [
157
+ # Geographic [4+6]/[4+5] - includes (01xxx) 0 and (01xxx) 1 as NDO.
128
158
  #
129
- # These 40 area codes have a mix of 4-6 and 4-5 numbers
159
+ # These 40 area codes have a mix of 4-6 and 4-5 numbers.
130
160
  # The three 'mixed' areas also have part of their number
131
161
  # range sub-allocated as 5-5.
132
162
  '1204', # Bolton
@@ -168,45 +198,610 @@ no_split = [
168
198
  '1946', # Whitehaven (Mixed area)
169
199
  '1949', # Whatton
170
200
  '1963', # Wincanton
171
- '1995', # Garstang
172
-
173
- # 6 is the fallback length.
174
- #
175
- # Mobile [4+6].
176
- #
177
- ('7400'..'7599').to_a,
178
- '7624',
179
- ('7700'..'7999').to_a,
201
+ '1995', # Garstang
202
+ ]
180
203
 
181
- # Geographic [4+6].
204
+ four_digit_ndc = [
205
+ # Geographic [4+6] - includes (01xxx) 0 and (01xxx) 1 as NDO.
182
206
  #
183
- # About 500 area codes use the 4-6 format
207
+ # These 542 area codes have only 4-6 numbers.
184
208
  # The three 'mixed' areas also have part of their number
185
209
  # range sub-allocated as 5-5 and one also has some 5-4.
186
- '1224', # Aberdeen
210
+ '1200', # Clitheroe
211
+ '1202', # Bournemouth
212
+ #1204 Bolton (see [4+6]/[4+5] areas)
213
+ '1205', # Boston
214
+ '1206', # Colchester
215
+ '1207', # Consett
216
+ #1208 Bodmin (see [4+6]/[4+5] areas)
217
+ '1209', # Redruth, Cornwall
218
+ '1223', # Cambridge
219
+ '1224', # Aberdeen
220
+ '1225', # Bath
221
+ '1226', # Barnsley
222
+ '1227', # Canterbury
223
+ '1228', # Carlisle
224
+ '1229', # Barrow-in-Furness and Millom (ELNS area)
225
+ '1233', # Ashford, Kent
226
+ '1234', # Bedford
227
+ '1235', # Abingdon
228
+ '1236', # Coatbridge
229
+ '1237', # Bideford
230
+ '1239', # Cardigan
231
+ '1241', # Arbroath
232
+ '1242', # Cheltenham
233
+ '1243', # Chichester, West Sussex
187
234
  '1244', # Chester
235
+ '1245', # Chelmsford
236
+ '1246', # Chesterfield
237
+ '1248', # Bangor, Gwynedd
238
+ '1249', # Chippenham
239
+ '1250', # Blairgowrie
240
+ '1252', # Aldershot
241
+ '1253', # Blackpool
242
+ #1254 Blackburn (see [4+6]/[4+5] areas)
243
+ '1255', # Clacton-on-Sea
244
+ '1256', # Basingstoke
245
+ '1257', # Coppull, Chorley
246
+ '1258', # Blandford
247
+ '1259', # Alloa
248
+ '1260', # Congleton
249
+ '1261', # Banff
250
+ '1262', # Bridlington
251
+ '1263', # Cromer
252
+ '1264', # Andover
253
+ '1267', # Carmarthen
254
+ '1268', # Basildon
255
+ '1269', # Ammanford
256
+ '1270', # Crewe
257
+ '1271', # Barnstaple
258
+ '1273', # Brighton
259
+ '1274', # Bradford
260
+ '1275', # Clevedon, Bristol
261
+ #1276 Camberley (see [4+6]/[4+5] areas)
262
+ '1277', # Brentwood
263
+ '1278', # Bridgwater
264
+ '1279', # Bishop's Stortford
265
+ '1280', # Buckingham
266
+ '1282', # Burnley
267
+ '1283', # Burton-on-Trent
268
+ '1284', # Bury St Edmunds
269
+ '1285', # Cirencester
270
+ '1286', # Caernarfon
271
+ '1287', # Guisborough
272
+ '1288', # Bude
273
+ '1289', # Berwick-upon-Tweed
274
+ '1290', # Cumnock, Ayrshire
275
+ '1291', # Chepstow
276
+ '1292', # Ayr
277
+ '1293', # Crawley
278
+ '1294', # Ardrossan, Ayrshire
279
+ '1295', # Banbury
280
+ '1296', # Aylesbury
281
+ #1297 Axminster (see [4+6]/[4+5] areas)
282
+ #1298 Buxton (see [4+6]/[4+5] areas)
283
+ '1299', # Bewdley
284
+ '1300', # Cerne Abbas, Dorset
285
+ '1301', # Arrochar
286
+ '1302', # Doncaster
287
+ '1303', # Folkestone
288
+ '1304', # Dover
289
+ '1305', # Dorchester
290
+ '1306', # Dorking
291
+ '1307', # Forfar
292
+ '1308', # Bridport, Dorset
293
+ '1309', # Forres
294
+ '1320', # Fort Augustus
295
+ '1322', # Dartford
296
+ '1323', # Eastbourne
297
+ '1324', # Falkirk
298
+ '1325', # Darlington
299
+ '1326', # Falmouth
300
+ '1327', # Daventry
301
+ '1328', # Fakenham
302
+ '1329', # Fareham
303
+ '1330', # Banchory, Deeside
304
+ '1332', # Derby
305
+ '1333', # Peat Inn and Leven, Fife
306
+ '1334', # St Andrews, Fife
307
+ '1335', # Ashbourne
308
+ '1337', # Ladybank, Fife
309
+ '1339', # Aboyne and Ballater (ELNS area)
310
+ '1340', # Craigellachie, Elgin
311
+ '1341', # Barmouth, Dolgellau
312
+ '1342', # East Grinstead
313
+ '1343', # Elgin
314
+ '1344', # Bracknell, Easthampstead
315
+ '1346', # Fraserburgh
316
+ '1347', # Easingwold
317
+ '1348', # Fishguard
318
+ '1349', # Dingwall
319
+ '1350', # Dunkeld
320
+ '1352', # Mold, Flint
321
+ '1353', # Ely
322
+ '1354', # Chatteris and March, Cambridgeshire, Fenland
323
+ '1355', # East Kilbride
324
+ '1356', # Brechin, Edzell
325
+ '1357', # Strathaven, East Kilbride
326
+ '1358', # Ellon
327
+ '1359', # Pakenham, Elmswell
328
+ '1360', # Killearn, Drymen
329
+ '1361', # Duns
330
+ '1362', # Dereham
331
+ #1363 Crediton (see [4+6]/[4+5] areas)
332
+ #1364 Ashburton, Devon (see [4+6]/[4+5] areas)
333
+ '1366', # Downham Market
334
+ '1367', # Faringdon
335
+ '1368', # Dunbar
336
+ '1369', # Dunoon
337
+ '1371', # Great Dunmow, Essex
338
+ '1372', # Esher, Epsom
339
+ '1373', # Frome
340
+ '1375', # Grays Thurrock, Essex
341
+ '1376', # Braintree, Essex
342
+ '1377', # Driffield
343
+ '1379', # Diss
344
+ '1380', # Devizes
345
+ '1381', # Fortrose
188
346
  '1382', # Dundee
347
+ '1383', # Dunfermline
348
+ #1384 Dudley (see [4+6]/[4+5] areas)
349
+ #1386 Evesham (see [4+6]/[4+5] areas)
189
350
  '1387', # Dumfries (Mixed area)
351
+ '1388', # Bishop Auckland, Durham and Stanhope (Eastgate) (ELNS area)
352
+ '1389', # Dumbarton
353
+ '1392', # Exeter
354
+ '1394', # Felixstowe
355
+ '1395', # Budleigh Salterton, Exmouth
356
+ '1397', # Fort William
357
+ '1398', # Dulverton, Exmoor
358
+ '1400', # Honington
359
+ '1403', # Horsham
360
+ #1404 Honiton (see [4+6]/[4+5] areas)
361
+ '1405', # Goole
362
+ '1406', # Holbeach
363
+ '1407', # Holyhead
364
+ '1408', # Golspie
365
+ '1409', # Holsworthy
366
+ #1420 Alton (see [4+6]/[4+5] areas)
367
+ '1422', # Halifax
368
+ '1423', # Boroughbridge and Harrogate (ELNS area)
369
+ '1424', # Hastings
370
+ '1425', # Ringwood, Highcliffe; New Milton, Ashley
371
+ '1427', # Gainsborough
372
+ '1428', # Haslemere
190
373
  '1429', # Hartlepool
191
- '1482', # Hull
374
+ '1430', # Market Weighton and North Cave, Howden (ELNS area)
375
+ '1431', # Helmsdale
376
+ '1432', # Hereford
377
+ '1433', # Hathersage
378
+ '1434', # Bellingham, Haltwhistle and Hexham (ELNS area)
379
+ '1435', # Heathfield
380
+ '1436', # Helensburgh
381
+ '1437', # Clynderwen and Haverfordwest (ELNS area)
382
+ '1438', # Stevenage, Hertfordshire
383
+ '1439', # Helmsley
384
+ '1440', # Haverhill
385
+ '1442', # Hemel Hempstead
386
+ '1443', # Pontypridd, Glamorgan
387
+ '1444', # Haywards Heath
388
+ '1445', # Gairloch
389
+ '1446', # Barry, Glamorgan
390
+ '1449', # Stowmarket, Gipping
391
+ '1450', # Hawick
392
+ '1451', # Stow-on-the-Wold, Gloucestershire
393
+ '1452', # Gloucester
394
+ '1453', # Dursley, Gloucestershire
395
+ '1454', # Chipping Sodbury, Gloucestershire
396
+ '1455', # Hinckley
397
+ '1456', # Glenurquhart
398
+ '1457', # Glossop
399
+ '1458', # Glastonbury
400
+ #1460 Chard, Ilminster (see [4+6]/[4+5] areas)
401
+ #1461 Gretna (see [4+6]/[4+5] areas)
402
+ '1462', # Hitchin
403
+ '1463', # Inverness
404
+ '1464', # Insch
405
+ '1465', # Girvan
406
+ '1466', # Huntly
407
+ '1467', # Inverurie
408
+ '1469', # Killingholme, Immingham
409
+ '1470', # Edinbane, Isle of Skye
410
+ '1471', # Broadford, Isle of Skye
411
+ '1472', # Grimsby
412
+ '1473', # Ipswich
413
+ '1474', # Gravesend
414
+ '1475', # Greenock
415
+ '1476', # Grantham
416
+ '1477', # Holmes Chapel
417
+ '1478', # Portree, Isle of Skye
418
+ '1479', # Grantown-on-Spey
419
+ #1480 Huntingdon (see [4+6]/[4+5] areas)
420
+ '1481', # Guernsey
421
+ '1482', # Kingston-upon-Hull
422
+ '1483', # Guildford
423
+ '1484', # Huddersfield
424
+ '1485', # Hunstanton
425
+ '1487', # Warboys, Huntingdon
426
+ #1488 Hungerford (see [4+6]/[4+5] areas)
427
+ '1489', # Bishops Waltham, Hamble Valley
428
+ '1490', # Corwen, Gwynedd
429
+ '1491', # Henley-on-Thames
430
+ '1492', # Colwyn Bay, Gwynedd
431
+ '1493', # Great Yarmouth
432
+ '1494', # High Wycombe
433
+ '1495', # Pontypool, Gwent
434
+ '1496', # Port Ellen, Islay
435
+ '1497', # Hay-on-Wye
436
+ '1499', # Inveraray
437
+ '1501', # Harthill, Lothian
438
+ '1502', # Lowestoft
439
+ '1503', # Looe
440
+ '1505', # Johnstone
441
+ '1506', # Bathgate, Lothian
442
+ '1507', # Alford (Lincs), Louth and Spilsby (Horncastle) (ELNS area)
443
+ '1508', # Brooke
444
+ '1509', # Loughborough
445
+ '1520', # Lochcarron
446
+ '1522', # Lincoln
447
+ #1524 Lancaster (Mixed area) (see [4+6]/[4+5] areas)
448
+ '1525', # Leighton Buzzard
449
+ '1526', # Martin, Lincolnshire
450
+ #1527 Redditch (see [4+6]/[4+5] areas)
451
+ '1528', # Laggan, Badenoch
452
+ '1529', # Sleaford, Lincolnshire
453
+ '1530', # Coalville, Ashby-de-la-Zouch, Leicestershire
454
+ '1531', # Ledbury
455
+ '1534', # Jersey
456
+ '1535', # Keighley
457
+ '1536', # Kettering
458
+ '1538', # Ipstones, Leek
192
459
  '1539', # Kendal (Mixed area)
460
+ '1540', # Kingussie
461
+ '1542', # Keith
462
+ '1543', # Cannock, Lichfield
463
+ '1544', # Kington
464
+ '1545', # Llanarth, Ceredigion
465
+ '1546', # Lochgilphead
466
+ '1547', # Knighton
467
+ '1548', # Kingsbridge
468
+ '1549', # Lairg
469
+ '1550', # Llandovery
470
+ '1553', # King's Lynn
471
+ '1554', # Llanelli
472
+ '1555', # Lanark
473
+ '1556', # Castle Douglas, Kirkcudbrightshire
474
+ '1557', # Kirkcudbright
475
+ '1558', # Llandeilo
476
+ '1559', # Llandysul
477
+ '1560', # Moscow
478
+ '1561', # Laurencekirk
479
+ #1562 Kidderminster (see [4+6]/[4+5] areas)
480
+ '1563', # Kilmarnock
481
+ '1564', # Lapworth, Knowle
482
+ '1565', # Knutsford
483
+ #1566 Launceston (see [4+6]/[4+5] areas)
484
+ '1567', # Killin
485
+ '1568', # Leominster
486
+ '1569', # Stonehaven, Laurencekirk
487
+ '1570', # Lampeter
488
+ '1571', # Lochinver
489
+ '1572', # Oakham
490
+ '1573', # Kelso
491
+ '1575', # Kirriemuir
492
+ '1576', # Lockerbie
493
+ '1577', # Kinross
494
+ '1578', # Lauder
495
+ '1579', # Liskeard
496
+ '1580', # Cranbrook, Kent
497
+ '1581', # New Luce, Luce
193
498
  '1582', # Luton
499
+ '1583', # Carradale, Kintyre
500
+ '1584', # Ludlow
501
+ '1586', # Campbeltown, Kintyre
502
+ '1588', # Bishops Castle, Ludlow
503
+ '1590', # Lymington
504
+ '1591', # Llanwrtyd Wells
505
+ '1592', # Kirkcaldy
506
+ '1593', # Lybster
507
+ '1594', # Lydney
508
+ '1595', # Lerwick, Foula and Fair Isle
509
+ '1597', # Llandrindod Wells
510
+ '1598', # Lynton
511
+ '1599', # Kyle
512
+ '1600', # Monmouth
513
+ '1603', # Norwich
514
+ '1604', # Northampton
515
+ #1606 Northwich (see [4+6]/[4+5] areas)
516
+ '1608', # Chipping Norton
517
+ '1609', # Northallerton
518
+ '1620', # North Berwick
519
+ '1621', # Maldon
520
+ '1622', # Maidstone
521
+ '1623', # Mansfield
522
+ '1624', # Isle of Man
523
+ '1625', # Macclesfield
524
+ '1626', # Newton Abbot
525
+ '1628', # Maidenhead
526
+ #1629 Matlock (see [4+6]/[4+5] areas)
527
+ '1630', # Market Drayton
528
+ '1631', # Oban
529
+ #1632 Numbers for Drama
530
+ '1633', # Newport
531
+ '1634', # Medway
532
+ #1635 Newbury (see [4+6]/[4+5] areas)
533
+ '1636', # Newark-on-Trent
534
+ '1637', # Newquay
535
+ '1638', # Newmarket
536
+ '1639', # Neath
537
+ '1641', # Strathy, Melvich
538
+ '1642', # Middlesbrough
539
+ '1643', # Minehead
540
+ '1644', # New Galloway
541
+ '1646', # Milford Haven
542
+ #1647 Moretonhampstead (see [4+6]/[4+5] areas)
543
+ '1650', # Cemmaes Road, Machynlleth
544
+ '1651', # Oldmeldrum
545
+ '1652', # Brigg, North Kelsey
546
+ '1653', # Malton
547
+ '1654', # Machynlleth
548
+ '1655', # Maybole
549
+ '1656', # Bridgend
550
+ #1659 Sanquhar, Nithsdale (see [4+6]/[4+5] areas)
551
+ '1661', # Prudhoe, Northumberland
552
+ '1663', # New Mills
553
+ '1664', # Melton Mowbray
554
+ '1665', # Alnwick, Northumberland
555
+ '1666', # Malmesbury
556
+ '1667', # Nairn
557
+ '1668', # Bamburgh, Northumberland
558
+ '1669', # Rothbury, Northumberland
194
559
  '1670', # Morpeth
560
+ '1671', # Newton Stewart
561
+ '1672', # Marlborough
562
+ '1673', # Market Rasen
563
+ '1674', # Montrose
564
+ '1675', # Coleshill, Warwickshire, Meriden
565
+ '1676', # Meriden
566
+ '1677', # Bedale, North Riding
567
+ '1678', # Bala, Meirionydd
568
+ '1680', # Craignure, Isle of Mull
569
+ '1681', # Fionnphort, Isle of Mull
570
+ '1683', # Moffat
571
+ '1684', # Malvern
572
+ '1685', # Merthyr Tydfil
573
+ '1686', # Llanidloes and Newtown (ELNS area)
574
+ '1687', # Mallaig
575
+ '1688', # Tobermory, Isle of Mull
576
+ '1689', # Orpington
577
+ '1690', # Betws-y-Coed
578
+ '1691', # Oswestry
579
+ '1692', # North Walsham
580
+ '1694', # Church Stretton
581
+ #1695 Skelmersdale (see [4+6]/[4+5] areas)
195
582
  '1697', # Brampton (Mixed area)
583
+ '1698', # Motherwell
584
+ '1700', # Rothesay
585
+ '1702', # Southend-on-Sea
586
+ '1704', # Southport
587
+ '1706', # Rochdale, Rossendale
588
+ '1707', # Welwyn Garden City, Hatfield and Potters Bar
589
+ '1708', # Romford
590
+ '1709', # Rotherham
591
+ '1720', # Isles of Scilly
592
+ '1721', # Peebles
593
+ '1722', # Salisbury
594
+ '1723', # Scarborough
595
+ '1724', # Scunthorpe
596
+ '1725', # Rockbourne
597
+ #1726 St Austell (see [4+6]/[4+5] areas)
598
+ '1727', # St Albans
599
+ '1728', # Saxmundham
600
+ '1729', # Settle, Ribblesdale
196
601
  '1730', # Petersfield
602
+ '1732', # Sevenoaks
603
+ '1733', # Peterborough
197
604
  '1736', # Penzance
605
+ '1737', # Redhill
606
+ '1738', # Perth
607
+ '1740', # Sedgefield
608
+ '1743', # Shrewsbury
609
+ #1744 St Helens (see [4+6]/[4+5] areas)
610
+ '1745', # Rhyl
611
+ '1746', # Bridgnorth, Shropshire
612
+ '1747', # Shaftesbury
613
+ '1748', # Richmond
614
+ '1749', # Shepton Mallet
615
+ #1750 Selkirk (see [4+6]/[4+5] areas)
616
+ '1751', # Pickering
617
+ '1752', # Plymouth
618
+ '1753', # Slough
619
+ '1754', # Skegness
620
+ '1756', # Skipton
621
+ '1757', # Selby
622
+ '1758', # Pwllheli
623
+ '1759', # Pocklington
624
+ '1760', # Swaffham
625
+ '1761', # Temple Cloud, Somerset
626
+ '1763', # Royston
627
+ '1764', # Crieff, Ruthven
628
+ '1765', # Ripon
629
+ '1766', # Porthmadog
630
+ '1767', # Sandy
631
+ #1768 Penrith (Mixed area) (see [4+6]/[4+5] areas)
632
+ '1769', # South Molton
633
+ '1770', # Isle of Arran
634
+ '1771', # Maud
198
635
  '1772', # Preston
199
- '1853', # Ullapool
636
+ '1773', # Ripley
637
+ '1775', # Spalding
638
+ '1776', # Stranraer
639
+ '1777', # Retford
640
+ '1778', # Market Deeping/Bourne
641
+ '1779', # Peterhead
642
+ '1780', # Stamford
643
+ '1782', # Stoke-on-Trent
644
+ '1784', # Staines
645
+ '1785', # Stafford
646
+ '1786', # Stirling
647
+ '1787', # Sudbury
648
+ '1788', # Rugby
649
+ '1789', # Stratford-upon-Avon
650
+ '1790', # Spilsby
651
+ '1792', # Swansea
652
+ '1793', # Swindon
653
+ '1794', # Romsey
654
+ '1795', # Sittingbourne, Sheppey
655
+ '1796', # Pitlochry
656
+ '1797', # Rye
657
+ '1798', # Pulborough, Sussex
658
+ '1799', # Saffron Walden
659
+ '1803', # Torquay
660
+ '1805', # Torrington
661
+ '1806', # Voe, Shetland
662
+ '1807', # Ballindalloch, Tomintoul
663
+ '1808', # Tomatin
664
+ '1809', # Tomdoun
665
+ '1821', # Kinrossie, Tayside
666
+ '1822', # Tavistock
667
+ '1823', # Taunton
668
+ '1824', # Ruthin, Vale of Clwyd
669
+ '1825', # Uckfield
670
+ #1827 Tamworth (see [4+6]/[4+5] areas)
671
+ '1828', # Coupar Angus, Tayside
672
+ '1829', # Tarporley
673
+ '1830', # Kirkwhelpington
674
+ '1832', # Clopton, Oundle
675
+ '1833', # Barnard Castle, Teesdale
676
+ '1834', # Narberth, Tenby
677
+ '1835', # St Boswells
678
+ #1837 Okehampton (see [4+6]/[4+5] areas)
679
+ '1838', # Dalmally, Tyndrum
680
+ '1840', # Camelford, Tintagel
681
+ '1841', # Padstow, Newquay
682
+ '1842', # Thetford
683
+ '1843', # Thanet
684
+ '1844', # Thame
685
+ '1845', # Thirsk
686
+ '1847', # Thurso and Tongue (ELNS area)
687
+ '1848', # Thornhill
688
+ '1851', # Great Bernera and Stornoway (ELNS area)
689
+ '1852', # Kilmelford
690
+ '1854', # Ullapool
691
+ '1855', # Ballachulish
692
+ '1856', # Orkney
693
+ '1857', # Sanday
694
+ '1858', # Market Harborough
695
+ '1859', # Harris
696
+ '1862', # Tain
697
+ '1863', # Ardgay, Tain
698
+ '1864', # Tinto, Abington, Crawford
699
+ '1865', # Oxford
700
+ '1866', # Kilchrenan
701
+ '1869', # Bicester, Oxfordshire
702
+ '1870', # Isle of Benbecula
703
+ '1871', # Castlebay
704
+ '1872', # Truro
705
+ '1873', # Abergavenny, Usk
706
+ '1874', # Brecon, Usk
707
+ '1875', # Tranent
708
+ '1876', # Lochmaddy
709
+ '1877', # Callander, Trossachs
710
+ '1878', # Lochboisdale
711
+ '1879', # Scarinish, Tiree
712
+ '1880', # Tarbert
713
+ '1882', # Kinloch Rannoch, Tummel Bridge
714
+ '1883', # Caterham
715
+ #1884 Tiverton (see [4+6]/[4+5] areas)
716
+ '1885', # Pencombe
717
+ '1886', # Bromyard, Teme Valley
718
+ '1887', # Aberfeldy, Tay Valley
719
+ '1888', # Turriff
720
+ '1889', # Rugeley, Uttoxeter
721
+ '1890', # Ayton, Berwickshire and Coldstream, Tweed (ELNS area)
722
+ '1892', # Tunbridge Wells
723
+ '1895', # Uxbridge
724
+ '1896', # Galashiels, Tweed
725
+ '1899', # Biggar, Tweed
726
+ #1900 Workington (see [4+6]/[4+5] areas)
727
+ '1902', # Wolverhampton
728
+ '1903', # Worthing
729
+ '1904', # York
730
+ #1905 Worcester (see [4+6]/[4+5] areas)
731
+ '1908', # Milton Keynes, Wolverton
732
+ '1909', # Worksop
733
+ '1920', # Ware
734
+ '1922', # Walsall
735
+ '1923', # Watford
736
+ '1924', # Wakefield
737
+ '1925', # Warrington
738
+ '1926', # Warwick
739
+ '1928', # Runcorn, Warrington
740
+ '1929', # Wareham
741
+ '1931', # Shap, Westmorland
742
+ '1932', # Weybridge
743
+ '1933', # Wellingborough
744
+ '1934', # Weston-super-Mare
745
+ #1935 Yeovil (see [4+6]/[4+5] areas)
746
+ '1937', # Wetherby
747
+ '1938', # Welshpool
748
+ '1939', # Wem
749
+ '1942', # Wigan
750
+ '1943', # Guiseley, Wharfedale
751
+ '1944', # West Heslerton
752
+ '1945', # Wisbech
753
+ #1946 Whitehaven (Mixed area) (see [4+6]/[4+5] areas)
200
754
  '1947', # Whitby
201
- # and 500 others
202
- ].flatten
755
+ '1948', # Whitchurch
756
+ #1949 Whatton (see [4+6]/[4+5] areas)
757
+ '1950', # Sandwick, Yell
758
+ '1951', # Colonsay
759
+ '1952', # Telford, Wellington
760
+ '1953', # Wymondham
761
+ '1954', # Madingley, Willingham
762
+ '1955', # Wick
763
+ '1957', # Mid Yell, Yell
764
+ '1959', # Westerham, West Kent
765
+ '1962', # Winchester
766
+ #1963 Wincanton (see [4+6]/[4+5] areas)
767
+ '1964', # Hornsea and Patrington, Withernsea (ELNS area)
768
+ '1967', # Strontian
769
+ '1968', # Penicuik, West Linton
770
+ '1969', # Leyburn, Wensleydale
771
+ '1970', # Aberystwyth, Ystwyth
772
+ '1971', # Scourie, Wrath
773
+ '1972', # Glenborrodale
774
+ '1974', # Llanon, Ystwyth
775
+ '1975', # Alford, Aberdeenshire and Strathdon, Water (ELNS area)
776
+ '1977', # Pontefract, West Riding
777
+ '1978', # Wrexham
778
+ '1980', # Amesbury, Wiltshire
779
+ '1981', # Wormbridge
780
+ '1982', # Builth Wells
781
+ '1983', # Isle of Wight
782
+ '1984', # Watchet, Williton
783
+ '1985', # Warminster
784
+ '1986', # Bungay, Waveney
785
+ '1987', # Ebbsfleet
786
+ '1988', # Wigtown
787
+ '1989', # Ross-on-Wye, Wye
788
+ '1992', # Lea Valley, Waltham Cross
789
+ '1993', # Witney
790
+ '1994', # St Clears, West Wales
791
+ #1995 Garstang, Wyre (see [4+6]/[4+5] areas)
792
+ '1997', # Strathpeffer, Wyvis
793
+ ]
203
794
 
204
795
  Phony.define do
205
- country '44', one_of(two_digit_ndc) >> split(4,4) | # 2-4-4
206
- match(/^([58]00)\d{6}$/) >> split(6) | # Special handling for 500 and 800: 3-6 numbers.
207
- one_of(three_digit_ndc) >> split(3,4) | # 3-3-4
208
- match(/^(16977)\d{4}$/) >> split(4) | # Special handling for 16977: 5-4 numbers.
209
- one_of(five_digit_ndc) >> split(5) | # 5-5
210
- one_of(no_split) >> split(6) | # 4-6 and 4-5
211
- fixed(4) >> split(6) # Catchall for 4-6 numbers.
212
- end
796
+ country '44',
797
+ trunk('0') |
798
+ one_of(mobile_ndc) >> split(6) | # 4-6
799
+ one_of(two_digit_ndc) >> split(4,4) | # 2-4-4
800
+ match(/^([58]00)\d{6}$/) >> split(6) | # 3-6, Special handling for 500 and 800.
801
+ one_of(three_digit_ndc) >> split(3,4) | # 3-3-4
802
+ match(/^(16977)\d{4}$/) >> split(4) | # 5-4, Special handling for 16977.
803
+ one_of(five_digit_ndc) >> split(5) | # 5-5
804
+ one_of(variable_length_number) >> split(5..6) | # 4-6 and 4-5, in 40 areas.
805
+ one_of(four_digit_ndc) >> split(6) | # 4-6
806
+ match(/^([135789]\d{3})/) >> split(6) # Catchall for plausible unallocated numbers.
807
+ end