1 <!-- Copyright (C) 2011 The Libphonenumber Authors 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 15 @author: Lara Rennie 16 @author: Shaopeng Jia 17 18 Additional Phone Number Formatting information, containing alternative 19 formats that are commonly used when writing phone numbers in certain 20 countries. Note that this is in addition to the formatting information 21 provided by the main PhoneNumberMetaData.xml file - formatting patterns 22 should not be duplicated. 23 24 Note also that only the most specific leading-digits pattern is present for 25 each pattern - the less specific ones are used only by the 26 AsYouTypeFormatter, and the AsYouTypeFormatter does not require information 27 on alternate formatting patterns. 28 29 For regions that share a country calling code, only the region with 30 mainCountryForCode set to true in PhoneNumberMetaData.xml should be present 31 here. 32 33 Note: Territories are in alphabetical order by their IDs, which are based on ISO 3166-1 34 two-letter country codes. The country names in the comments are the official short names 35 in English according to ISO 3166-1. 36 37 For more information on what each element represents, see 38 resources/phonemetadata.proto 39 --> 40 41 <!DOCTYPE phoneNumberMetadata [ 42 <!ELEMENT phoneNumberMetadata (territories)> 43 <!ELEMENT territories (territory+)> 44 <!ELEMENT territory (availableFormats)> 45 <!ELEMENT numberFormat (leadingDigits*, format, intlFormat*)> 46 <!ELEMENT leadingDigits (#PCDATA)> 47 <!ELEMENT format (#PCDATA)> 48 <!ELEMENT intlFormat (#PCDATA)> 49 50 <!ATTLIST territory countryCode CDATA #REQUIRED> 51 <!ATTLIST numberFormat pattern CDATA #REQUIRED> 52 ]> 53 54 <phoneNumberMetadata> 55 <territories> 56 <!-- Australia (AU) --> 57 <territory countryCode="61"> 58 <availableFormats> 59 <numberFormat pattern="(1[389]\d{2})(\d{2})(\d{2})(\d{2})"> 60 <leadingDigits> 61 1(?: 62 [38]00| 63 90 64 ) 65 </leadingDigits> 66 <format>$1 $2 $3 $4</format> 67 </numberFormat> 68 <numberFormat pattern="(1[389]\d{2})(\d{6})"> 69 <leadingDigits> 70 1(?: 71 [38]00| 72 90 73 ) 74 </leadingDigits> 75 <format>$1 $2</format> 76 </numberFormat> 77 <numberFormat pattern="([2378])(\d{8})"> 78 <leadingDigits>[2378]</leadingDigits> 79 <format>$1 $2</format> 80 </numberFormat> 81 </availableFormats> 82 </territory> 83 84 <!-- Austria (AT) --> 85 <territory countryCode="43"> 86 <availableFormats> 87 <numberFormat pattern="(5)(\d{3,12})"> 88 <leadingDigits>5[079]</leadingDigits> 89 <format>$1 $2</format> 90 </numberFormat> 91 <numberFormat pattern="(50)(\d{2})(\d{2})(\d{2,4})"> 92 <leadingDigits>50</leadingDigits> 93 <format>$1 $2 $3 $4</format> 94 </numberFormat> 95 <numberFormat pattern="(5\d)(\d{2})(\d{2})(\d{2})(\d{2,4})"> 96 <leadingDigits>5[079]</leadingDigits> 97 <format>$1 $2 $3 $4 $5</format> 98 </numberFormat> 99 <numberFormat pattern="(5\d)(\d{5})(\d{4,6})"> 100 <leadingDigits>5[079]</leadingDigits> 101 <format>$1 $2 $3</format> 102 </numberFormat> 103 <numberFormat pattern="(5\d)(\d{6,7})"> 104 <leadingDigits>5[079]</leadingDigits> 105 <format>$1 $2</format> 106 </numberFormat> 107 </availableFormats> 108 </territory> 109 110 <!-- Brazil (BR) --> 111 <territory countryCode="55"> 112 <availableFormats> 113 <numberFormat pattern="(\d{2})(\d{8})" > 114 <leadingDigits>[1-9][1-9]</leadingDigits> 115 <format>$1 $2</format> 116 </numberFormat> 117 </availableFormats> 118 </territory> 119 120 <!-- Germany (DE) --> 121 <territory countryCode="49"> 122 <availableFormats> 123 <numberFormat pattern="(\d{2})(\d{3})(\d{3,4})"> 124 <leadingDigits> 125 3[02]| 126 40| 127 [68]9 128 </leadingDigits> 129 <format>$1/$2 $3</format> 130 </numberFormat> 131 <numberFormat pattern="(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})"> 132 <leadingDigits> 133 3[02]| 134 40| 135 [68]9 136 </leadingDigits> 137 <format>$1/$2 $3 $4 $5</format> 138 </numberFormat> 139 <numberFormat pattern="(\d{2})(\d{4})(\d{3,4})"> 140 <leadingDigits> 141 3[02]| 142 40| 143 [68]9 144 </leadingDigits> 145 <format>$1/$2 $3</format> 146 </numberFormat> 147 <numberFormat pattern="(\d{2})(\d{3})(\d{2})(\d{2})"> 148 <leadingDigits> 149 3[02]| 150 40| 151 [68]9 152 </leadingDigits> 153 <format>$1/$2 $3 $4</format> 154 </numberFormat> 155 <numberFormat pattern="(\d{2})(\d{3})(\d{3})(\d{2,3})"> 156 <leadingDigits> 157 3[02]| 158 40| 159 [68]9 160 </leadingDigits> 161 <format>$1/$2 $3 $4</format> 162 </numberFormat> 163 <!-- 3 digit area codes. --> 164 <numberFormat pattern="(\d{3})(\d{3})(\d{2,4})"> 165 <leadingDigits> 166 2(?: 167 \d1| 168 0[2389]| 169 1[24]| 170 28| 171 34 172 )| 173 3(?: 174 [3-9][15]| 175 40 176 )| 177 [4-8][1-9]1| 178 9(?: 179 06| 180 [1-9]1 181 ) 182 </leadingDigits> 183 <format>$1/$2 $3</format> 184 </numberFormat> 185 <numberFormat pattern="(\d{3})(\d{4})(\d{3,4})"> 186 <leadingDigits> 187 2(?: 188 \d1| 189 0[2389]| 190 1[24]| 191 28| 192 34 193 )| 194 3(?: 195 [3-9][15]| 196 40 197 )| 198 [4-8][1-9]1| 199 9(?: 200 06| 201 [1-9]1 202 ) 203 </leadingDigits> 204 <format>$1/$2 $3</format> 205 </numberFormat> 206 <numberFormat pattern="(\d{3})(\d{3})(\d{2})(\d{2})"> 207 <leadingDigits> 208 2(?: 209 \d1| 210 0[2389]| 211 1[24]| 212 28| 213 34 214 )| 215 3(?: 216 [3-9][15]| 217 40 218 )| 219 [4-8][1-9]1| 220 9(?: 221 06| 222 [1-9]1 223 ) 224 </leadingDigits> 225 <format>$1/$2 $3 $4</format> 226 </numberFormat> 227 <numberFormat pattern="(\d{3})(\d{3})(\d{2})(\d{2})(\d)"> 228 <leadingDigits> 229 2(?: 230 \d1| 231 0[2389]| 232 1[24]| 233 28| 234 34 235 )| 236 3(?: 237 [3-9][15]| 238 40 239 )| 240 [4-8][1-9]1| 241 9(?: 242 06| 243 [1-9]1 244 ) 245 </leadingDigits> 246 <format>$1/$2 $3 $4 $5</format> 247 </numberFormat> 248 <numberFormat pattern="(\d{3})(\d{3})(\d{3})(\d{2,3})"> 249 <leadingDigits> 250 2(?: 251 \d1| 252 0[2389]| 253 1[24]| 254 28| 255 34 256 )| 257 3(?: 258 [3-9][15]| 259 40 260 )| 261 [4-8][1-9]1| 262 9(?: 263 06| 264 [1-9]1 265 ) 266 </leadingDigits> 267 <format>$1/$2 $3 $4</format> 268 </numberFormat> 269 <!-- 4 digit area codes. --> 270 <numberFormat pattern="(\d{4})(\d{3})(\d{3,4})"> 271 <leadingDigits> 272 [24-6]| 273 [7-9](?: 274 \d[1-9]| 275 [1-9]\d 276 )| 277 3(?: 278 3(?: 279 0[1-467]| 280 2[127-9]| 281 3[124578]| 282 [46][1246]| 283 7[1257-9]| 284 8[1256]| 285 9[145] 286 )| 287 4(?: 288 2[135]| 289 3[1357]| 290 4[13578]| 291 6[1246]| 292 7[1356]| 293 9[1346] 294 )| 295 5(?: 296 0[14]| 297 2[1-3589]| 298 3[1357]| 299 4[1246]| 300 6[1-4]| 301 7[1346]| 302 8[13568]| 303 9[1246] 304 )| 305 6(?: 306 0[356]| 307 2[1-489]| 308 3[124-6]| 309 4[1347]| 310 6[13]| 311 7[12579]| 312 8[1-356]| 313 9[135] 314 )| 315 7(?: 316 2[1-7]| 317 3[1357]| 318 4[145]| 319 6[1-5]| 320 7[1-4] 321 )| 322 8(?: 323 21| 324 3[1468]| 325 4[1347]| 326 6[0135-9]| 327 7[1467]| 328 8[136] 329 )| 330 9(?: 331 0[12479]| 332 2[1358]| 333 3[1357]| 334 4[134679]| 335 6[1-9]| 336 7[136]| 337 8[147]| 338 9[1468] 339 ) 340 ) 341 </leadingDigits> 342 <format>$1/$2 $3</format> 343 </numberFormat> 344 <numberFormat pattern="(\d{4})(\d{4})(\d{1,4})"> 345 <leadingDigits> 346 [24-6]| 347 [7-9](?: 348 \d[1-9]| 349 [1-9]\d 350 )| 351 3(?: 352 3(?: 353 0[1-467]| 354 2[127-9]| 355 3[124578]| 356 [46][1246]| 357 7[1257-9]| 358 8[1256]| 359 9[145] 360 )| 361 4(?: 362 2[135]| 363 3[1357]| 364 4[13578]| 365 6[1246]| 366 7[1356]| 367 9[1346] 368 )| 369 5(?: 370 0[14]| 371 2[1-3589]| 372 3[1357]| 373 4[1246]| 374 6[1-4]| 375 7[1346]| 376 8[13568]| 377 9[1246] 378 )| 379 6(?: 380 0[356]| 381 2[1-489]| 382 3[124-6]| 383 4[1347]| 384 6[13]| 385 7[12579]| 386 8[1-356]| 387 9[135] 388 )| 389 7(?: 390 2[1-7]| 391 3[1357]| 392 4[145]| 393 6[1-5]| 394 7[1-4] 395 )| 396 8(?: 397 21| 398 3[1468]| 399 4[1347]| 400 6[0135-9]| 401 7[1467]| 402 8[136] 403 )| 404 9(?: 405 0[12479]| 406 2[1358]| 407 3[1357]| 408 4[134679]| 409 6[1-9]| 410 7[136]| 411 8[147]| 412 9[1468] 413 ) 414 ) 415 </leadingDigits> 416 <format>$1/$2 $3</format> 417 </numberFormat> 418 <numberFormat pattern="(\d{4})(\d{3})(\d{3})(\d{3})"> 419 <leadingDigits> 420 [24-6]| 421 [7-9](?: 422 \d[1-9]| 423 [1-9]\d 424 )| 425 3(?: 426 3(?: 427 0[1-467]| 428 2[127-9]| 429 3[124578]| 430 [46][1246]| 431 7[1257-9]| 432 8[1256]| 433 9[145] 434 )| 435 4(?: 436 2[135]| 437 3[1357]| 438 4[13578]| 439 6[1246]| 440 7[1356]| 441 9[1346] 442 )| 443 5(?: 444 0[14]| 445 2[1-3589]| 446 3[1357]| 447 4[1246]| 448 6[1-4]| 449 7[1346]| 450 8[13568]| 451 9[1246] 452 )| 453 6(?: 454 0[356]| 455 2[1-489]| 456 3[124-6]| 457 4[1347]| 458 6[13]| 459 7[12579]| 460 8[1-356]| 461 9[135] 462 )| 463 7(?: 464 2[1-7]| 465 3[1357]| 466 4[145]| 467 6[1-5]| 468 7[1-4] 469 )| 470 8(?: 471 21| 472 3[1468]| 473 4[1347]| 474 6[0135-9]| 475 7[1467]| 476 8[136] 477 )| 478 9(?: 479 0[12479]| 480 2[1358]| 481 3[1357]| 482 4[134679]| 483 6[1-9]| 484 7[136]| 485 8[147]| 486 9[1468] 487 ) 488 ) 489 </leadingDigits> 490 <format>$1/$2 $3 $4</format> 491 </numberFormat> 492 <numberFormat pattern="(\d{4})(\d{2})(\d{3})(\d{2})"> 493 <leadingDigits> 494 [24-6]| 495 [7-9](?: 496 \d[1-9]| 497 [1-9]\d 498 )| 499 3(?: 500 3(?: 501 0[1-467]| 502 2[127-9]| 503 3[124578]| 504 [46][1246]| 505 7[1257-9]| 506 8[1256]| 507 9[145] 508 )| 509 4(?: 510 2[135]| 511 3[1357]| 512 4[13578]| 513 6[1246]| 514 7[1356]| 515 9[1346] 516 )| 517 5(?: 518 0[14]| 519 2[1-3589]| 520 3[1357]| 521 4[1246]| 522 6[1-4]| 523 7[1346]| 524 8[13568]| 525 9[1246] 526 )| 527 6(?: 528 0[356]| 529 2[1-489]| 530 3[124-6]| 531 4[1347]| 532 6[13]| 533 7[12579]| 534 8[1-356]| 535 9[135] 536 )| 537 7(?: 538 2[1-7]| 539 3[1357]| 540 4[145]| 541 6[1-5]| 542 7[1-4] 543 )| 544 8(?: 545 21| 546 3[1468]| 547 4[1347]| 548 6[0135-9]| 549 7[1467]| 550 8[136] 551 )| 552 9(?: 553 0[12479]| 554 2[1358]| 555 3[1357]| 556 4[134679]| 557 6[1-9]| 558 7[136]| 559 8[147]| 560 9[1468] 561 ) 562 ) 563 </leadingDigits> 564 <format>$1/$2 $3 $4</format> 565 </numberFormat> 566 <numberFormat pattern="(\d{4})(\d{3})(\d{2})(\d{2})"> 567 <leadingDigits> 568 [24-6]| 569 [7-9](?: 570 \d[1-9]| 571 [1-9]\d 572 )| 573 3(?: 574 3(?: 575 0[1-467]| 576 2[127-9]| 577 3[124578]| 578 [46][1246]| 579 7[1257-9]| 580 8[1256]| 581 9[145] 582 )| 583 4(?: 584 2[135]| 585 3[1357]| 586 4[13578]| 587 6[1246]| 588 7[1356]| 589 9[1346] 590 )| 591 5(?: 592 0[14]| 593 2[1-3589]| 594 3[1357]| 595 4[1246]| 596 6[1-4]| 597 7[1346]| 598 8[13568]| 599 9[1246] 600 )| 601 6(?: 602 0[356]| 603 2[1-489]| 604 3[124-6]| 605 4[1347]| 606 6[13]| 607 7[12579]| 608 8[1-356]| 609 9[135] 610 )| 611 7(?: 612 2[1-7]| 613 3[1357]| 614 4[145]| 615 6[1-5]| 616 7[1-4] 617 )| 618 8(?: 619 21| 620 3[1468]| 621 4[1347]| 622 6[0135-9]| 623 7[1467]| 624 8[136] 625 )| 626 9(?: 627 0[12479]| 628 2[1358]| 629 3[1357]| 630 4[134679]| 631 6[1-9]| 632 7[136]| 633 8[147]| 634 9[1468] 635 ) 636 ) 637 </leadingDigits> 638 <format>$1/$2 $3 $4</format> 639 </numberFormat> 640 <numberFormat pattern="(\d{4})(\d{2})(\d{2})(\d{2,3})"> 641 <leadingDigits> 642 [24-6]| 643 [7-9](?: 644 \d[1-9]| 645 [1-9]\d 646 )| 647 3(?: 648 3(?: 649 0[1-467]| 650 2[127-9]| 651 3[124578]| 652 [46][1246]| 653 7[1257-9]| 654 8[1256]| 655 9[145] 656 )| 657 4(?: 658 2[135]| 659 3[1357]| 660 4[13578]| 661 6[1246]| 662 7[1356]| 663 9[1346] 664 )| 665 5(?: 666 0[14]| 667 2[1-3589]| 668 3[1357]| 669 4[1246]| 670 6[1-4]| 671 7[1346]| 672 8[13568]| 673 9[1246] 674 )| 675 6(?: 676 0[356]| 677 2[1-489]| 678 3[124-6]| 679 4[1347]| 680 6[13]| 681 7[12579]| 682 8[1-356]| 683 9[135] 684 )| 685 7(?: 686 2[1-7]| 687 3[1357]| 688 4[145]| 689 6[1-5]| 690 7[1-4] 691 )| 692 8(?: 693 21| 694 3[1468]| 695 4[1347]| 696 6[0135-9]| 697 7[1467]| 698 8[136] 699 )| 700 9(?: 701 0[12479]| 702 2[1358]| 703 3[1357]| 704 4[134679]| 705 6[1-9]| 706 7[136]| 707 8[147]| 708 9[1468] 709 ) 710 ) 711 </leadingDigits> 712 <format>$1/$2 $3 $4</format> 713 </numberFormat> 714 <!-- 5 digit area codes. --> 715 <numberFormat pattern="(\d{5})(\d{3})(\d{3,4})"> 716 <leadingDigits>3</leadingDigits> 717 <format>$1/$2 $3</format> 718 </numberFormat> 719 <numberFormat pattern="(\d{5})(\d{4})(\d{3,4})"> 720 <leadingDigits>3</leadingDigits> 721 <format>$1/$2 $3</format> 722 </numberFormat> 723 <numberFormat pattern="(\d{5})(\d{3})(\d{3})(\d{3})"> 724 <leadingDigits>3</leadingDigits> 725 <format>$1/$2 $3 $4</format> 726 </numberFormat> 727 <!-- Mobile number formatting rules. --> 728 <numberFormat pattern="(1\d{3})(\d{2})(\d{3})(\d{2})"> 729 <leadingDigits>15</leadingDigits> 730 <format>$1 $2 $3 $4</format> 731 </numberFormat> 732 <numberFormat pattern="(1\d{3})(\d{3})(\d{4})"> 733 <leadingDigits>15</leadingDigits> 734 <format>$1 $2 $3</format> 735 </numberFormat> 736 <numberFormat pattern="(1\d{3})(\d{4})(\d{3})"> 737 <leadingDigits>15</leadingDigits> 738 <format>$1 $2 $3</format> 739 </numberFormat> 740 <numberFormat pattern="(1\d{2})(\d{8})"> 741 <leadingDigits>15</leadingDigits> 742 <format>$1 $2</format> 743 </numberFormat> 744 <numberFormat pattern="([18]\d{2})(\d{2,3})(\d{3})(\d{2})"> 745 <leadingDigits> 746 1[5-7]| 747 800 748 </leadingDigits> 749 <format>$1 $2 $3 $4</format> 750 </numberFormat> 751 <numberFormat pattern="(8\d{2})(\d{6})(\d{2})(\d{1,4})"> 752 <leadingDigits>800</leadingDigits> 753 <format>$1 $2 $3 $4</format> 754 </numberFormat> 755 <numberFormat pattern="(\d{3})(\d)(\d{3})(\d{3,4})"> 756 <leadingDigits> 757 180| 758 900[1359] 759 </leadingDigits> 760 <format>$1 $2 $3 $4</format> 761 </numberFormat> 762 <numberFormat pattern="(\d{3})(\d)(\d{4})(\d{3,4})"> 763 <leadingDigits> 764 180| 765 900[1359] 766 </leadingDigits> 767 <format>$1 $2 $3 $4</format> 768 </numberFormat> 769 <numberFormat pattern="(\d{4})(\d{4,10})"> 770 <leadingDigits> 771 180| 772 900[1359] 773 </leadingDigits> 774 <format>$1 $2</format> 775 </numberFormat> 776 <numberFormat pattern="(\d{3})(\d{3})(\d{4})(\d{2})"> 777 <leadingDigits> 778 900[1359] 779 </leadingDigits> 780 <format>$1 $2 $3 $4</format> 781 </numberFormat> 782 </availableFormats> 783 </territory> 784 785 <!-- Great Britain (GB) --> 786 <territory countryCode="44" > 787 <availableFormats> 788 <!-- London. --> 789 <numberFormat pattern="(\d{3})(\d{3})(\d{4})"> 790 <leadingDigits>20</leadingDigits> 791 <format>$1-$2-$3</format> 792 </numberFormat> 793 <!-- 7ddd (not 70, 76) with 10 digits. Note: DOES include 7624 when used for IM. Also 794 includes the four-digit fixed-line codes. --> 795 <numberFormat pattern="(\d{4})(\d{3})(\d{3})"> 796 <leadingDigits> 797 1[2-48][02-9]| 798 7(?: 799 [1-5789]| 800 624 801 ) 802 </leadingDigits> 803 <format>$1 $2 $3</format> 804 </numberFormat> 805 <!-- 7ddd (not 70, 76) with 10 digits.--> 806 <numberFormat pattern="(\d{3})(\d{4})(\d{3})"> 807 <leadingDigits>7[1-5789]</leadingDigits> 808 <format>$1 $2 $3</format> 809 </numberFormat> 810 <numberFormat pattern="(80\d)(\d{3,4})(\d{3})"> 811 <leadingDigits>80</leadingDigits> 812 <format>$1 $2 $3</format> 813 </numberFormat> 814 </availableFormats> 815 </territory> 816 817 <!-- Japan (JP) --> 818 <territory countryCode="81" > 819 <availableFormats> 820 <!-- Toll-free, premium-rate and UAN numbers --> 821 <numberFormat pattern="(\d{3})(\d{2})(\d{4})"> 822 <leadingDigits> 823 (?: 824 12| 825 57| 826 99 827 )0 828 </leadingDigits> 829 <format>$1-$2-$3</format> 830 </numberFormat> 831 <numberFormat pattern="(\d{3})(\d{2})(\d{2})(\d{2})"> 832 <leadingDigits> 833 (?: 834 12| 835 57| 836 99 837 )0 838 </leadingDigits> 839 <format>$1-$2-$3-$4</format> 840 </numberFormat> 841 <numberFormat pattern="(\d{3})(\d{4})(\d{2})"> 842 <leadingDigits> 843 (?: 844 12| 845 57| 846 99 847 )0 848 </leadingDigits> 849 <format>$1-$2-$3</format> 850 </numberFormat> 851 </availableFormats> 852 </territory> 853 854 <!-- Portugal (PT) --> 855 <territory countryCode="351" > 856 <availableFormats> 857 <!-- Lisbon/Porto numbers are usually formatted with the 21 or 22 separated - but sometimes 858 they are formatted as 21X or 22X. --> 859 <numberFormat pattern="(2\d{2})(\d{3})(\d{3})"> 860 <leadingDigits>2[12]</leadingDigits> 861 <format>$1 $2 $3</format> 862 </numberFormat> 863 <!-- Commonly used mobile formatting pattern. --> 864 <numberFormat pattern="(9\d)(\d{3})(\d{4})"> 865 <leadingDigits>9</leadingDigits> 866 <format>$1 $2 $3</format> 867 </numberFormat> 868 <numberFormat pattern="(\d{2})(\d{3})(\d{2})(\d{2})"> 869 <leadingDigits> 870 2[12]| 871 9 872 </leadingDigits> 873 <format>$1 $2 $3 $4</format> 874 </numberFormat> 875 </availableFormats> 876 </territory> 877 </territories> 878 </phoneNumberMetadata> 879