-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathPhoneNumberMetadataForTesting.xml
1249 lines (1208 loc) · 49.2 KB
/
PhoneNumberMetadataForTesting.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- Copyright (C) 2009 The Libphonenumber Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@author: Shaopeng Jia
Metadata on Phone Number Plan and formatting rules. This file is used
solely for the purpose of unittesting, so data in this file is not
necessarily consistent with that of PhoneNumberMetadata.xml.
-->
<phoneNumberMetadata>
<territories>
<!-- Andorra -->
<territory id="AD" countryCode="376" internationalPrefix="00">
<generalDesc>
<nationalNumberPattern>\d{6}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>\d{6}</nationalNumberPattern>
<possibleLengths national="6"/>
<exampleNumber>123456</exampleNumber>
</fixedLine>
</territory>
<!-- United Arab Emirates -->
<!-- Added since when formatting the number for mobile dialling we have special rules to handle
it. -->
<territory id="AE" countryCode="971" internationalPrefix="00">
<generalDesc>
<nationalNumberPattern>[1-9]\d{8}</nationalNumberPattern>
</generalDesc>
<uan>
<nationalNumberPattern>600\d{6}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>600123456</exampleNumber>
</uan>
</territory>
<!-- Armenia -->
<!-- Added to test same mobile and fixed-line in custom builds. -->
<territory id="AM" countryCode="374" internationalPrefix="00"
nationalPrefix="0">
<generalDesc>
<nationalNumberPattern>[1-9]\d{7}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[1-9]\d{7}</nationalNumberPattern>
<possibleLengths national="8" localOnly="5,6"/>
<exampleNumber>10123456</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>[1-9]\d{7}</nationalNumberPattern>
<possibleLengths national="8" localOnly="5,6"/>
<exampleNumber>10123456</exampleNumber>
</mobile>
</territory>
<!-- Angola -->
<!-- This country has been coopted to test the case of a national prefix with a non-numeric
symbol in it. It is also useful since it has no national prefix formatting rule. -->
<territory id="AO" countryCode="244" internationalPrefix="00" nationalPrefix="0~0">
<availableFormats>
<numberFormat pattern="(\d{3})(\d{3})(\d{3})">
<format>$1 $2 $3</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[29]\d{8}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>2\d(?:[26-9]\d|\d[26-9])\d{5}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>222123456</exampleNumber>
</fixedLine>
<mobile>
<!-- Expanded the 92 prefix possibilities to match numbers found online. -->
<nationalNumberPattern>9[1-3]\d{7}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>923123456</exampleNumber>
</mobile>
</territory>
<!-- Argentina -->
<territory id="AR" countryCode="54" internationalPrefix="00"
nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG"
nationalPrefixForParsing="0(?:(11|343|3715)15)?"
nationalPrefixTransformRule="9$1">
<!-- Note in nationalPrefixForParsing, the areacode (such as 11, 343, etc.), when present in
front of carrier selection code 15, is captured to replace $1 in
nationalPrefixTransformRule -->
<availableFormats>
<numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>11</leadingDigits>
<format>$1 $2-$3</format>
</numberFormat>
<numberFormat pattern="(\d{4})(\d{2})(\d{4})">
<leadingDigits>1[02-9]|[23]</leadingDigits>
<format>$1 $2-$3</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{2})(\d{4})(\d{4})">
<leadingDigits>911</leadingDigits>
<format>$2 15 $3-$4</format>
<intlFormat>$1 $2 $3 $4</intlFormat>
</numberFormat>
<numberFormat pattern="(\d)(\d{4})(\d{2})(\d{4})"
carrierCodeFormattingRule="$NP$FG $CC">
<leadingDigits>9(?:1[02-9]|[23])</leadingDigits>
<format>$2 $3-$4</format>
<intlFormat>$1 $2 $3 $4</intlFormat>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>[68]</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[1-3689]\d{9,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[1-3]\d{5,9}</nationalNumberPattern>
<possibleLengths national="[6-10]"/>
<exampleNumber>1234567890</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>9\d{10}|[1-3]\d{9}</nationalNumberPattern>
<possibleLengths national="10,11"/>
<exampleNumber>9234567890</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>80\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>8034567890</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>6(0\d|10)\d{7}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>6234567890</exampleNumber>
</premiumRate>
</territory>
<!-- Australia -->
<!-- Country calling code shared with Cocos Islands (CC) and Christmas Islands (CX) -->
<territory id="AU" countryCode="61" internationalPrefix="001[12]"
nationalPrefix="0" preferredInternationalPrefix="0011"
nationalPrefixFormattingRule="$NP$FG">
<availableFormats>
<numberFormat nationalPrefixFormattingRule="$FG"
pattern="(\d{4})(\d{3})(\d{3})" >
<leadingDigits>1</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{4})(\d{4})">
<leadingDigits>[2-478]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
</availableFormats>
<generalDesc >
<nationalNumberPattern>[1-578]\d{4,14}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[2378]\d{8}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>212345678</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>4\d{8}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>412345678</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>1800\d{6}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>1800123456</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>190[0126]\d{6}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>1900123456</exampleNumber>
</premiumRate>
</territory>
<!-- Barbados -->
<territory id="BB" countryCode="1" internationalPrefix="011">
<generalDesc>
<nationalNumberPattern>246\d{7}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<possibleLengths national="10" localOnly="7"/>
<exampleNumber>2464567890</exampleNumber>
</fixedLine>
</territory>
<!-- Brazil -->
<!-- This country is used to test ShortNumberInfo, so at least the country calling code must be
recognised by the library. It is also used for formatInOriginalFormat tests, so some length
metadata is needed. -->
<territory id="BR" countryCode="55" internationalPrefix="00">
<generalDesc>
<nationalNumberPattern>\d{8,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>\d{8,10}</nationalNumberPattern>
<possibleLengths national="10" localOnly="8"/>
<exampleNumber>12345678</exampleNumber>
</fixedLine>
</territory>
<!-- Bahamas -->
<territory id="BS" countryCode="1" internationalPrefix="011"
nationalPrefix="1">
<generalDesc>
<nationalNumberPattern>(242|8(00|66|77|88)|900)\d{7}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>
242(?:
3(?:
02|
[236][1-9]|
4[0-24-9]|
5[0-68]|
7[3-57]|
9[2-5]
)|
4(?:
2[237]|
51|
64|
77
)|
502|
636|
702
)\d{4}
</nationalNumberPattern>
<possibleLengths national="10" localOnly="7"/>
<exampleNumber>2425027890</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>242(357|359|457|557)\d{4}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>2423577890</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>8(00|66|77|88)\d{7}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>8001234567</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>900\d{7}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>9001234567</exampleNumber>
</premiumRate>
</territory>
<!-- Belarus -->
<!-- This country has been coopted to test the case of a national prefix formatting rule with a
space in it and the case where a number happens to begin with the national prefix, but
would become too short if the prefix is stripped. -->
<territory id="BY" countryCode="375" internationalPrefix="810" nationalPrefix="8"
nationalPrefixForParsing="80?|99999" nationalPrefixFormattingRule="$NP $FG">
<availableFormats>
<!-- We make some bogus formatting templates that differ only in length to check that
switching formatting patterns works as expected.-->
<numberFormat pattern="(\d{4})">
<leadingDigits>[1-8]</leadingDigits>
<format>$1</format>
</numberFormat>
<!-- This pattern has an override to remove the space after the national prefix. -->
<numberFormat pattern="(\d{2})(\d{3})" nationalPrefixFormattingRule="$NP$FG">
<leadingDigits>[1-8]</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})">
<leadingDigits>[1-8]</leadingDigits>
<format>$1 $2</format>
</numberFormat>
</availableFormats>
<generalDesc>
<!-- This numbering plan is completely bogus, but is used to test the AYTF logic. For that
reason, it is kept very simple. -->
<nationalNumberPattern>[1-9]\d{5}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[1-9]\d{5}</nationalNumberPattern>
<possibleLengths national="6"/>
<exampleNumber>112345</exampleNumber>
</fixedLine>
</territory>
<!-- Canada -->
<territory id="CA" countryCode="1" internationalPrefix="011">
<generalDesc>
<nationalNumberPattern>226\d{7}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>226\d{7}</nationalNumberPattern>
<possibleLengths national="10" localOnly="7"/>
<exampleNumber>2261234567</exampleNumber>
</fixedLine>
</territory>
<!-- Cocos Islands -->
<!-- Country calling code shared with Australia. -->
<!-- This country is used to test ShortNumberInfo, so at least the country calling code must be
recognised by the library, and some length information is needed for parsing. -->
<territory id="CC" countryCode="61" internationalPrefix="00">
<generalDesc>
<nationalNumberPattern>\d{6,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>\d{6,10}</nationalNumberPattern>
<possibleLengths national="10" localOnly="6"/>
<exampleNumber>2261234567</exampleNumber>
</fixedLine>
</territory>
<!-- China -->
<!-- Used to test as-you-type-formatter with complicated number format patterns. Also used to
test that not all geographical mobile numbers have an area code. -->
<territory id="CN" countryCode="86" internationalPrefix="00" nationalPrefix="0">
<availableFormats>
<numberFormat nationalPrefixFormattingRule="$NP$FG" pattern="(\d{3})(\d{5,6})"
carrierCodeFormattingRule="$CC $FG">
<leadingDigits>[3-9]</leadingDigits>
<leadingDigits>[3-9]\d{2}[19]</leadingDigits>
<leadingDigits>
[3-9]\d{2}(?:
10|
95
)
</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<!-- Note that mobile numbers do not get formatted with the national prefix. -->
<numberFormat nationalPrefixFormattingRule="$FG" pattern="(\d{3})(\d{8})">
<leadingDigits>1</leadingDigits>
<format>$1 $2</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>
[1-7]\d{6,11}|
8[0-357-9]\d{6,9}|
9\d{7,10}
</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[2-9]\d{10}</nationalNumberPattern>
<possibleLengths national="11"/>
<exampleNumber>91234567</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>
1(?:
[38]\d|
4[57]|
5[0-35-9]|
7[0136-8]
)\d{8}
</nationalNumberPattern>
<possibleLengths national="11"/>
<exampleNumber>13123456789</exampleNumber>
</mobile>
</territory>
<!-- Colombia (CO) -->
<!-- Data is here to check formatForMobileDialling() API is no more considering CO as special
i.e it returns regular E.164 format rather than using the 03 carrier code. -->
<territory id="CO" countryCode="57" nationalPrefix="0"
nationalPrefixForParsing="0(4(?:[14]4|56)|[579])?" mobileNumberPortableRegion="true">
<availableFormats>
<numberFormat pattern="(\d{3})(\d{7})" nationalPrefixFormattingRule="($FG)"
carrierCodeFormattingRule="$NP$CC $FG">
<leadingDigits>6</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{7})" carrierCodeFormattingRule="$NP$CC $FG">
<leadingDigits>3</leadingDigits>
<format>$1 $2</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>
(?:
60|
3\d
)\d{8}
</nationalNumberPattern>
</generalDesc>
<fixedLine>
<possibleLengths national="10"/>
<exampleNumber>6012345678</exampleNumber>
<nationalNumberPattern>60\d{8}</nationalNumberPattern>
</fixedLine>
<mobile>
<possibleLengths national="10"/>
<exampleNumber>3211234567</exampleNumber>
<nationalNumberPattern>
3(?:
0[0-5]|
1\d|
2[0-3]|
5[01]|
70
)\d{7}
</nationalNumberPattern>
</mobile>
</territory>
<!-- Christmas Islands -->
<!-- Country calling code shared with Australia. -->
<!-- This country is used to test ShortNumberInfo, so at least the country calling code must be
recognised by the library, and some length information is needed for parsing. -->
<territory id="CX" countryCode="61" internationalPrefix="00">
<generalDesc>
<nationalNumberPattern>\d{8,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>\d{8,10}</nationalNumberPattern>
<possibleLengths national="10" localOnly="8"/>
<exampleNumber>2261234567</exampleNumber>
</fixedLine>
</territory>
<!-- Germany -->
<territory id="DE" countryCode="49" internationalPrefix="00"
nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
<availableFormats>
<numberFormat pattern="(\d{3})(\d{3,8})">
<leadingDigits>2|3[3-9]|906|[4-9][1-9]1</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{4,11})">
<leadingDigits>[34]0|[68]9</leadingDigits>
<format>$1/$2</format>
</numberFormat>
<!-- Extra fictional pattern for shorter numbers with the same prefixes as the following
pattern, to illustrate the problem the AYTF has with real patterns that share this
property. -->
<numberFormat pattern="(\d{2})(\d{2})">
<leadingDigits>[4-9]</leadingDigits>
<leadingDigits>[4-6]|[7-9](?:\d[1-9]|[1-9]\d)</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<numberFormat pattern="(\d{4})(\d{2,7})">
<leadingDigits>[4-9]</leadingDigits>
<leadingDigits>[4-6]|[7-9](?:\d[1-9]|[1-9]\d)</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{1})(\d{6})">
<leadingDigits>800</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3,4})(\d{4})">
<leadingDigits>900</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>\d{4,14}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>
(?:
[24-6]\d{2}|
3[03-9]\d|
[789](?:
0[2-9]|
[1-9]\d
)
)\d{1,8}
</nationalNumberPattern>
<possibleLengths national="[4-11]" localOnly="2,3"/>
<exampleNumber>30123456</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>1(5\d{9}|7\d{8}|6[02]\d{8}|63\d{7})</nationalNumberPattern>
<possibleLengths national="10,11"/>
<exampleNumber>15123456789</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>800\d{7}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>8001234567</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>900([135]\d{6}|9\d{7})</nationalNumberPattern>
<possibleLengths national="10,11"/>
<exampleNumber>9001234567</exampleNumber>
</premiumRate>
</territory>
<!-- France -->
<territory id="FR" countryCode="33" nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG"
internationalPrefix="00">
<availableFormats>
<!-- We use this to test the phone number matcher. For our test-case, the formatting
pattern must have as the first group a sub-part of the country calling code,
and have a national prefix. This corresponds to the test number +33 3 34 2312. -->
<numberFormat pattern="(\d)(\d{2})(\d{2})(\d{2})">
<leadingDigits>3</leadingDigits>
<format>$1 $2 $3 $4</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>3\d{6}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>3\d{6}</nationalNumberPattern>
<possibleLengths national="7"/>
<exampleNumber>3123456</exampleNumber>
</fixedLine>
</territory>
<!-- United Kingdom -->
<territory id="GB" countryCode="44" internationalPrefix="00"
nationalPrefix="0" nationalPrefixFormattingRule="($NP$FG)"
mobileNumberPortableRegion="true">
<availableFormats>
<numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>[1-59]|[78]0</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{3})(\d{3})(\d{3})">
<leadingDigits>6</leadingDigits>
<format>$1 $2 $3 $4</format>
</numberFormat>
<numberFormat pattern="(\d{4})(\d{3})(\d{3})">
<leadingDigits>7[1-57-9]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>8[47]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>\d{10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[1-6]\d{9}</nationalNumberPattern>
<possibleLengths national="9,10" localOnly="6,7,8"/>
<exampleNumber>3123456789</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>7[1-57-9]\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>7123456789</exampleNumber>
</mobile>
<pager>
<nationalNumberPattern>76\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>7623456789</exampleNumber>
</pager>
<tollFree>
<nationalNumberPattern>80\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>8023456789</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>9[018]\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>9023456789</exampleNumber>
</premiumRate>
<sharedCost>
<nationalNumberPattern>8(?:4[3-5]|7[0-2])\d{7}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>8433456789</exampleNumber>
</sharedCost>
<voip>
<nationalNumberPattern>56\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>5633456789</exampleNumber>
</voip>
<personalNumber>
<nationalNumberPattern>70\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>7033456789</exampleNumber>
</personalNumber>
</territory>
<!-- Guernsey -->
<!-- This country is used to test ShortNumberInfo, so at least the country calling code must be
recognised by the library, and it must be the same as that of the United Kingdom. -->
<territory id="GG" countryCode="44" internationalPrefix="00">
<generalDesc>
<nationalNumberPattern>\d{6,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>\d{6,10}</nationalNumberPattern>
<possibleLengths national="10" localOnly="6"/>
<exampleNumber>7033456789</exampleNumber>
</fixedLine>
</territory>
<!-- Italy -->
<!-- http://en.wikipedia.org/wiki/%2B39 -->
<territory id="IT" countryCode="39" internationalPrefix="00">
<availableFormats>
<numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>0[26]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{4})(\d{3,4})">
<leadingDigits>0[13-57-9]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{3,4})">
<leadingDigits>3</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3,6})">
<leadingDigits>8</leadingDigits>
<format>$1 $2</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[0389]\d{5,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>0\d{9,10}</nationalNumberPattern>
<possibleLengths national="10,11"/>
<exampleNumber>0123456789</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>3\d{8,9}</nationalNumberPattern>
<possibleLengths national="9,10"/>
<exampleNumber>3123456789</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>80(?:0\d{6}|3\d{3})</nationalNumberPattern>
<possibleLengths national="6,9"/>
<exampleNumber>800123456</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>89(?:2\d{3}|9\d{6})</nationalNumberPattern>
<possibleLengths national="6,9"/>
<exampleNumber>892123</exampleNumber>
</premiumRate>
</territory>
<!-- Japan -->
<!-- The metadata here is added to unit test AsYouTypeFormatter for JP, which requires switching
patterns as digits beyond the third one are entered. As a result, only a few fake
formatting rules are added. -->
<territory id="JP" countryCode="81" internationalPrefix="010"
nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
<availableFormats>
<numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>[57-9]0</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{2})(\d{3})(\d{4})">
<leadingDigits>[57-9]0</leadingDigits>
<format>$1 $2 $3 $4</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{3})(\d{4})">
<leadingDigits>111|222|333</leadingDigits>
<leadingDigits>(?:111|222|333)1</leadingDigits>
<leadingDigits>(?:111|222|333)11</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{4})(\d)(\d{4})">
<leadingDigits>222|333</leadingDigits>
<leadingDigits>2221|3332</leadingDigits>
<leadingDigits>22212|3332</leadingDigits>
<leadingDigits>222120|3332</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{2})(\d{4})">
<leadingDigits>[23]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{4})">
<leadingDigits>077</leadingDigits>
<format>$1-$2</format>
</numberFormat>
<!-- The following numberFormat is added to test that the format containing the star sign is
not used by the AYTF. -->
<numberFormat nationalPrefixFormattingRule="$FG" pattern="(\d{4})">
<leadingDigits>[23]</leadingDigits>
<format>*$1</format>
</numberFormat>
</availableFormats>
<noInternationalDialling>
<nationalNumberPattern>[23]\d{3}</nationalNumberPattern>
<possibleLengths national="4"/>
<exampleNumber>2123</exampleNumber>
</noInternationalDialling>
<generalDesc>
<nationalNumberPattern>07\d{5}|[1-357-9]\d{3,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>07\d{5}|[1-357-9]\d{3,10}</nationalNumberPattern>
<possibleLengths national="[4-11]"/>
<exampleNumber>0712345</exampleNumber>
</fixedLine>
<tollFree>
<nationalNumberPattern>0777[01]\d{2}</nationalNumberPattern>
<possibleLengths national="7"/>
<exampleNumber>0777012</exampleNumber>
</tollFree>
</territory>
<!-- Korea (Rep. of) -->
<!-- http://www.itu.int/oth/T0202000072/en -->
<!-- http://en.wikipedia.org/wiki/%2B82 -->
<!-- http://www.kcc.go.kr/user.do?mode=view&page=P02030300&dc=K02030300&boardId=1074&boardSeq=2349 -->
<!-- http://www.kcc.go.kr/user.do?mode=view&page=P02030300&dc=K02030300&boardId=1074&boardSeq=2240 -->
<!-- http://www.telecentro.co.kr/sub/index.php?job=detail&ebcf_id=faq&page=1&mid=0503&eb_seq=36 -->
<!-- Exceptions :
internationalPrefix
0031, 0033, 0071, 0073 - Special services of KT and DACOM, ignorable
nationalPrefix
1[4-6]XX-YYYY - Country-wide common number services, display as it is without hyphens -->
<territory id="KR" countryCode="82" internationalPrefix="00(?:[124-68]|[37]\d{2})"
nationalPrefix="0" nationalPrefixForParsing="0(8[1-46-8]|85\d{2})?"
nationalPrefixFormattingRule="$NP$FG">
<availableFormats>
<numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>1(?:0|1[19]|[69]9|5[458])|[57]0</leadingDigits>
<leadingDigits>1(?:0|1[19]|[69]9|5(?:44|59|8))|[57]0</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{3})(\d{4})">
<leadingDigits>1(?:[169][2-8]|[78]|5[1-4])|[68]0|[3-6][1-9][2-9]</leadingDigits>
<leadingDigits>1(?:[169][2-8]|[78]|5(?:[1-3]|4[56]))|[68]0|[3-6][1-9][2-9]</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d)(\d{4})">
<leadingDigits>131</leadingDigits>
<leadingDigits>1312</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{2})(\d{4})">
<leadingDigits>131</leadingDigits>
<leadingDigits>131[13-9]</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>13[2-9]</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{2})(\d{3})(\d{4})">
<leadingDigits>30</leadingDigits>
<format>$1-$2-$3-$4</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{4})(\d{4})">
<leadingDigits>2(?:[26]|3[0-467])</leadingDigits>
<leadingDigits>2(?:[26]|3(?:01|1[45]|2[17-9]|39|4|6[67]|7[078]))</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{3})(\d{4})">
<leadingDigits>2(?:3[0-35-9]|[457-9])</leadingDigits>
<leadingDigits>2(?:3(?:0[02-9]|1[0-36-9]|2[02-6]|3[0-8]|6[0-589]|7[1-69]|[589])|[457-9])</leadingDigits>
<format>$1-$2-$3</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{3})">
<leadingDigits>21[0-46-9]</leadingDigits>
<leadingDigits>21(?:[0-247-9]|3[124]|6[1269])</leadingDigits>
<format>$1-$2</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{4})">
<leadingDigits>21[36]</leadingDigits>
<leadingDigits>21(?:3[035-9]|6[03-578])</leadingDigits>
<format>$1-$2</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{3})">
<leadingDigits>[3-6][1-9]1</leadingDigits>
<leadingDigits>[3-6][1-9]1(?:[0-46-9])</leadingDigits>
<leadingDigits>[3-6][1-9]1(?:[0-247-9]|3[124]|6[1269])</leadingDigits>
<format>$1-$2</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{4})">
<leadingDigits>[3-6][1-9]1</leadingDigits>
<leadingDigits>[3-6][1-9]1[36]</leadingDigits>
<leadingDigits>[3-6][1-9]1(?:3[035-9]|6[03-578])</leadingDigits>
<format>$1-$2</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[1-7]\d{3,9}|8\d{8}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>(?:2|[34][1-3]|5[1-5]|6[1-4])(?:1\d{2,3}|[2-9]\d{6,7})</nationalNumberPattern>
<possibleLengths national="[4-10]"/>
<exampleNumber>22123456</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>1[0-25-9]\d{7,8}</nationalNumberPattern>
<possibleLengths national="9,10"/>
<exampleNumber>1023456789</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>80\d{7}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>801234567</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>60[2-9]\d{6}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>602345678</exampleNumber>
</premiumRate>
<personalNumber>
<nationalNumberPattern>50\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>5012345678</exampleNumber>
</personalNumber>
<voip>
<nationalNumberPattern>70\d{8}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>7012345678</exampleNumber>
</voip>
</territory>
<!-- Mexico -->
<territory id="MX" countryCode="52" internationalPrefix="00"
nationalPrefix="01" nationalPrefixForParsing="01|04[45](\d{10})"
nationalPrefixTransformRule="1$1" nationalPrefixFormattingRule="$NP $FG"
nationalPrefixOptionalWhenFormatting="true">
<availableFormats>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>[89]00</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<!-- This formatting pattern is added to test that the AYTF should return unformatted
results when the first group is dropped in the output. -->
<numberFormat pattern="(\d{3})(\d{2})(\d{5})">
<leadingDigits>901</leadingDigits>
<format>$2 $3</format>
<intlFormat>$2 $3</intlFormat>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>33|55|81</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>[2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat nationalPrefixFormattingRule="$FG" pattern="(\d)(\d{2})(\d{4})(\d{4})">
<leadingDigits>1(?:33|55|81)</leadingDigits>
<format>045 $2 $3 $4</format>
<intlFormat>$1 $2 $3 $4</intlFormat>
</numberFormat>
<numberFormat nationalPrefixFormattingRule="$FG" pattern="(\d)(\d{3})(\d{3})(\d{4})">
<leadingDigits>1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9])</leadingDigits>
<format>045 $2 $3 $4</format>
<intlFormat>$1 $2 $3 $4</intlFormat>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[1-9]\d{9,10}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[2-9]\d{9}</nationalNumberPattern>
<possibleLengths national="10" localOnly="7"/>
<exampleNumber>2123456789</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>1\d{10}</nationalNumberPattern>
<possibleLengths national="11"/>
<exampleNumber>11234567890</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>800\d{7}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>8001234567</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>900\d{7}</nationalNumberPattern>
<possibleLengths national="10"/>
<exampleNumber>9001234567</exampleNumber>
</premiumRate>
</territory>
<!-- New Zealand -->
<territory id="NZ" countryCode="64" internationalPrefix="00"
nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
<availableFormats>
<numberFormat pattern="(\d)(\d{3})(\d{4})">
<leadingDigits>24|[34679]</leadingDigits>
<format>$1-$2 $3</format>
</numberFormat>
<numberFormat pattern="(\d)(\d{3})(\d{3,5})">
<leadingDigits>2[179]</leadingDigits>
<format>$1-$2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{3,4})">
<leadingDigits>[89]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>
[289]\d{7,9}|
[3-7]\d{7}
</nationalNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>24099\d{3}|(?:3[2-79]|[479][2-689]|6[235-9])\d{6}</nationalNumberPattern>
<possibleLengths national="7,8"/>
<exampleNumber>24099123</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>2(?:[027]\d{7}|9\d{6,7}|1(?:0\d{5,7}|[12]\d{5,6}|[3-9]\d{5})|4[1-9]\d{6}|8\d{7,8})</nationalNumberPattern>
<possibleLengths national="[8-10]"/>
<exampleNumber>201234567</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>800\d{6,7}</nationalNumberPattern>
<possibleLengths national="9,10"/>
<exampleNumber>8001234567</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>900\d{6,7}</nationalNumberPattern>
<possibleLengths national="9,10"/>
<exampleNumber>9001234567</exampleNumber>
</premiumRate>
</territory>
<!-- Poland -->
<!-- http://en.wikipedia.org/wiki/%2B48 -->
<territory id="PL" countryCode="48" internationalPrefix="00"
nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
<availableFormats>
<numberFormat pattern="(\d{2})(\d{3})(\d{2})(\d{2})">
<format>$1 $2 $3 $4</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[1-9]\d{8}</nationalNumberPattern>
</generalDesc>
<mobile>
<nationalNumberPattern>(?:5[01]|6[069]|7[289]|88)\d{7}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>501234567</exampleNumber>
</mobile>
<tollFree>
<nationalNumberPattern>800\d{6}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>800123456</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>70\d{7}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>701234567</exampleNumber>
</premiumRate>
</territory>
<!-- Réunion (French Departments and Territories in the Indian Ocean) -->
<!-- Note this shares the same country code as La Mayotte and French
Southern Territories, and the formatting patterns here are used by all of
them. This is present to test leadingDigits. -->
<territory id="RE" countryCode="262" leadingDigits="262|6(?:9[23]|47)|8"
internationalPrefix="00" nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
<availableFormats>
<numberFormat pattern="(\d{3})(\d{2})(\d{2})(\d{2})">
<format>$1 $2 $3 $4</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[268]\d{8}</nationalNumberPattern>
</generalDesc>
<fixedLine>
<!-- 0876 numbers are mentioned in the plan, but none in use can be
found. -->
<nationalNumberPattern>262\d{6}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>262161234</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>6(?:9[23]|47)\d{6}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>692123456</exampleNumber>
</mobile>
<!-- 08* Numbers in Réunion are the same as those valid in France. -->
<tollFree>
<nationalNumberPattern>80\d{7}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>801234567</exampleNumber>
</tollFree>
<premiumRate>
<nationalNumberPattern>8(?:1[01]|2[0156]|84|9[0-37-9])\d{6}</nationalNumberPattern>
<possibleLengths national="9"/>
<exampleNumber>810123456</exampleNumber>
</premiumRate>
</territory>