Browse Source

Small feature changes, metadata updates.

pull/567/head
Lara Scheidegger 15 years ago
committed by Mihaela Rosca
parent
commit
3c39b530ee
26 changed files with 441 additions and 314 deletions
  1. +12
    -1
      java/release_notes.txt
  2. +11
    -2
      java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java
  3. +297
    -124
      java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml
  4. +0
    -1
      java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml
  5. +15
    -17
      java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  6. +17
    -0
      java/src/com/google/i18n/phonenumbers/Phonenumber.java
  7. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF
  8. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF
  9. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BO
  10. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES
  11. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB
  12. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GG
  13. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GN
  14. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IM
  15. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS
  16. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JE
  17. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP
  18. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KR
  19. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW
  20. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE
  21. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PT
  22. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RU
  23. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE
  24. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT
  25. BIN
      java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZW
  26. +89
    -169
      java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java

+ 12
- 1
java/release_notes.txt View File

@ -1,3 +1,14 @@
October 15th, 2010
* Code improvements:
- Allowed parsing of numbers that start with "++" or a full-width "+" symbol
- Allowed reg-exs for national and possible number patterns to have white space in them in the source XML file
- Added a more useful toString method for the phone number proto class
* Metadata changes:
- Updates to existing countries: AF, BF, BO, ES, GB, GG, IM, IS, JE, JE, JP, KR, PE, PT, RU, SE,
TT, ZW
* Bug fixes:
- Parsing empty strings with invalid region codes no longer throws a null pointer exception
September 4th, 2010 September 4th, 2010
* Code improvement: * Code improvement:
- Added new phone number type: pager - Added new phone number type: pager
@ -49,4 +60,4 @@ July 30th, 2010
* Code improvement * Code improvement
- China local number formatting for AsYouTypeFormatter - China local number formatting for AsYouTypeFormatter
- improve extension parsing to handle number in the form of +1 (645) 123 1234 ext. 910#
- improve extension parsing to handle number in the form of +1 (645) 123 1234 ext. 910#

+ 11
- 2
java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java View File

@ -96,6 +96,15 @@ public class BuildMetadataFromXml {
} }
private static String validateRE(String regex) { private static String validateRE(String regex) {
return validateRE(regex, false);
}
private static String validateRE(String regex, boolean removeWhitespace) {
// Removes all the whitespace and newline from the regexp. Not using pattern compile options to
// make it work across programming languages.
if (removeWhitespace) {
regex = regex.replaceAll("\\s", "");
}
Pattern.compile(regex); Pattern.compile(regex);
// return regex itself if it is of correct regex syntax // return regex itself if it is of correct regex syntax
// i.e. compile did not fail with a PatternSyntaxException. // i.e. compile did not fail with a PatternSyntaxException.
@ -286,13 +295,13 @@ public class BuildMetadataFromXml {
NodeList possiblePattern = element.getElementsByTagName("possibleNumberPattern"); NodeList possiblePattern = element.getElementsByTagName("possibleNumberPattern");
if (possiblePattern.getLength() > 0) { if (possiblePattern.getLength() > 0) {
numberDesc.setPossibleNumberPattern( numberDesc.setPossibleNumberPattern(
validateRE(possiblePattern.item(0).getFirstChild().getNodeValue()));
validateRE(possiblePattern.item(0).getFirstChild().getNodeValue(), true));
} }
NodeList validPattern = element.getElementsByTagName("nationalNumberPattern"); NodeList validPattern = element.getElementsByTagName("nationalNumberPattern");
if (validPattern.getLength() > 0) { if (validPattern.getLength() > 0) {
numberDesc.setNationalNumberPattern( numberDesc.setNationalNumberPattern(
validateRE(validPattern.item(0).getFirstChild().getNodeValue()));
validateRE(validPattern.item(0).getFirstChild().getNodeValue(), true));
} }
if (!liteBuild) { if (!liteBuild) {


+ 297
- 124
java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml View File

@ -36,7 +36,7 @@
<!ELEMENT territories (territory+)> <!ELEMENT territories (territory+)>
<!ELEMENT territory (availableFormats?, generalDesc?, fixedLine?, mobile?, tollFree?, <!ELEMENT territory (availableFormats?, generalDesc?, fixedLine?, mobile?, tollFree?,
premiumRate?, sharedCost?, personalNumber?, voip?, pager?)> premiumRate?, sharedCost?, personalNumber?, voip?, pager?)>
<!ELEMENT generalDesc (nationalNumberPattern, possibleNumberPattern, exampleNumber?)>
<!ELEMENT generalDesc (nationalNumberPattern, possibleNumberPattern)>
<!ELEMENT fixedLine (nationalNumberPattern?, possibleNumberPattern?, exampleNumber?)> <!ELEMENT fixedLine (nationalNumberPattern?, possibleNumberPattern?, exampleNumber?)>
<!ELEMENT mobile (nationalNumberPattern?, possibleNumberPattern?, exampleNumber?)> <!ELEMENT mobile (nationalNumberPattern?, possibleNumberPattern?, exampleNumber?)>
<!ELEMENT tollFree (nationalNumberPattern?, possibleNumberPattern?, exampleNumber?)> <!ELEMENT tollFree (nationalNumberPattern?, possibleNumberPattern?, exampleNumber?)>
@ -184,7 +184,7 @@
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<nationalNumberPattern>[2-7]\d{8}</nationalNumberPattern> <nationalNumberPattern>[2-7]\d{8}</nationalNumberPattern>
<possibleNumberPattern>\d{9}</possibleNumberPattern>
<possibleNumberPattern>\d{7,9}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<nationalNumberPattern>(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\d{6}</nationalNumberPattern> <nationalNumberPattern>(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\d{6}</nationalNumberPattern>
@ -192,6 +192,7 @@
</fixedLine> </fixedLine>
<mobile> <mobile>
<nationalNumberPattern>7[057-9]\d{7}</nationalNumberPattern> <nationalNumberPattern>7[057-9]\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{9}</possibleNumberPattern>
<exampleNumber>701234567</exampleNumber> <exampleNumber>701234567</exampleNumber>
</mobile> </mobile>
</territory> </territory>
@ -967,9 +968,9 @@
<availableFormats> <availableFormats>
<!-- The national numbering plan from ITU suggests grouping of 2, 2 and 4, but <!-- The national numbering plan from ITU suggests grouping of 2, 2 and 4, but
we have chosen to use the standard from numbers found on the internet instead.--> we have chosen to use the standard from numbers found on the internet instead.-->
<numberFormat pattern="(\d{2})(\d{2})(\d{2})(\d{2})">
<format>$1 $2 $3 $4</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{2})(\d{2})(\d{2})">
<format>$1 $2 $3 $4</format>
</numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<nationalNumberPattern>[2457]\d{7}</nationalNumberPattern> <nationalNumberPattern>[2457]\d{7}</nationalNumberPattern>
@ -984,7 +985,7 @@
<!-- Including the whole range of 75 despite the document restricting it <!-- Including the whole range of 75 despite the document restricting it
to only a few, since even the Zain help-line is outside the range that to only a few, since even the Zain help-line is outside the range that
the document specifies. --> the document specifies. -->
<nationalNumberPattern>7(?:[024-6]\d|1[0-489]|8[013-9]|90)\d{5}</nationalNumberPattern>
<nationalNumberPattern>7(?:[024-6]\d|1[0-489]|3[01]|8[013-9]|9[012])\d{5}</nationalNumberPattern>
<exampleNumber>70123456</exampleNumber> <exampleNumber>70123456</exampleNumber>
</mobile> </mobile>
</territory> </territory>
@ -1215,9 +1216,66 @@
</mobile> </mobile>
</territory> </territory>
<!-- Bolivia -->
<territory id="BO" countryCode="591" internationalPrefix="001[0-3]"
nationalPrefix="0">
<!-- Bolivia -->
<!-- http://www.itu.int/oth/T020200001A/en -->
<!-- http://www.bolivia.com/Servicios/Plandenumeracion.pdf -->
<!-- http://www.itu.int/dms_pub/itu-t/oth/02/02/T020200001A0001MSWE.doc -->
<territory id="BO" countryCode="591"
internationalPrefix="00(1\d)?"
nationalPrefix="0"
nationalPrefixForParsing="0(1\d)?">
<availableFormats>
<numberFormat pattern="([234])(\d{7})">
<leadingDigits>[234]</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<numberFormat pattern="([67]\d{7})">
<leadingDigits>[67]</leadingDigits>
<format>$1</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[23467]\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{7,8}</possibleNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>
(?:
2(?:
2\d{2}
|
5(?:11|[258]\d|9[67])
|
6(?:12|2\d|9[34])
|
8(?:2[34]|39|62)
)
|
3(?:
3\d{2}
|
4(?:6\d|8[24])
|
8(?:25|42|5[257]|86|9[25])
|
9(?:2\d|3[234]|4[248]|5[24]|6[2-6]|7\d)
)
|
4(?:
4\d{2}
|
6(?:11|[24689]\d|72)
)
)\d{4}
</nationalNumberPattern>
<possibleNumberPattern>\d{7,8}</possibleNumberPattern>
<exampleNumber>22123456</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>[67]\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{8}</possibleNumberPattern>
<exampleNumber>71234567</exampleNumber>
</mobile>
</territory> </territory>
<!-- Brazil --> <!-- Brazil -->
@ -1234,7 +1292,7 @@
code.--> code.-->
<availableFormats> <availableFormats>
<numberFormat nationalPrefixFormattingRule="($FG)" <numberFormat nationalPrefixFormattingRule="($FG)"
pattern="(\d{2})(\d{4})(\d{4})"
pattern="(\d{2})(\d{4})(\d{4})"
carrierCodeFormattingRule="$NP $CC $FG"> carrierCodeFormattingRule="$NP $CC $FG">
<leadingDigits>[1-9][1-9]</leadingDigits> <leadingDigits>[1-9][1-9]</leadingDigits>
<format>$1 $2-$3</format> <format>$1 $2-$3</format>
@ -2409,7 +2467,7 @@
</territory> </territory>
<!-- Spain --> <!-- Spain -->
<!-- http://www.mityc.es/telecomunicaciones/es-ES/Servicios/Numeracion/PlanNacional/Paginas/PlanNacionalNumeracion.aspx -->
<!-- http://www.mityc.es/telecomunicaciones/es-ES/Servicios/Numeracion/Paginas/Plan.aspx -->
<territory id="ES" countryCode="34" internationalPrefix="00"> <territory id="ES" countryCode="34" internationalPrefix="00">
<availableFormats> <availableFormats>
<numberFormat pattern="([5-9]\d{2})(\d{2})(\d{2})(\d{2})"> <numberFormat pattern="([5-9]\d{2})(\d{2})(\d{2})(\d{2})">
@ -2440,8 +2498,9 @@
<nationalNumberPattern>90[12]\d{6}</nationalNumberPattern> <nationalNumberPattern>90[12]\d{6}</nationalNumberPattern>
<exampleNumber>901123456</exampleNumber> <exampleNumber>901123456</exampleNumber>
</sharedCost> </sharedCost>
<!-- Modelling non-geographic nomadic numbers as Personal Numbers too. -->
<personalNumber> <personalNumber>
<nationalNumberPattern>70\d{7}</nationalNumberPattern>
<nationalNumberPattern>(?:51|70)\d{7}</nationalNumberPattern>
<exampleNumber>701234567</exampleNumber> <exampleNumber>701234567</exampleNumber>
</personalNumber> </personalNumber>
</territory> </territory>
@ -2621,45 +2680,47 @@
</territory> </territory>
<!-- United Kingdom --> <!-- United Kingdom -->
<!-- http://www.ofcom.org.uk/telecoms/ioi/numbers/ -->
<!-- http://stakeholders.ofcom.org.uk/telecoms/numbering/ -->
<!-- Document with differences between the official documents and what is
correct: http://80.68.88.13/stuff/infotemp/ -->
<!-- Note that this excludes Isle of Man, Jersey and Guernsey prefixes for <!-- Note that this excludes Isle of Man, Jersey and Guernsey prefixes for
the purposes of validation, although the formatting rules are shared. --> the purposes of validation, although the formatting rules are shared. -->
<territory id="GB" countryCode="44" internationalPrefix="00" <territory id="GB" countryCode="44" internationalPrefix="00"
nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG" nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG"
mainCountryForCode="true" >
mainCountryForCode="true">
<availableFormats> <availableFormats>
<!-- 2d, 55, 56, 70, 76 with 10 digits -->
<numberFormat pattern="(\d{2})(\d{4})(\d{4})"> <numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>[23]|5[56]|9[018]</leadingDigits>
<leadingDigits>2|5[56]|7[06]</leadingDigits>
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{3,4})">
<leadingDigits>1(?:1|\d1)|500</leadingDigits>
<!-- 11d, 1d1, 3dd, 9dd with 10 digits -->
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>1(?:1|\d1)|3|9[018]</leadingDigits>
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
<!-- 5-digit area codes (excluding national prefix) are very rare in GB, and are only
available in the following areas: 13873(Langholm), 15242(Hornby), 15394(Hawkshead),
15395(Grange-Over-Sands), 15396(Sedbergh), 16973(Wigton), 16974(Raughton Head),
16977(Brampton), 17683(Appleby), 17684(Pooley Bridge), 17687(Keswick), 19467(Gosforth)-->
<!-- 1dddd with 9 or 10 digits.
These area codes are very rare in GB, and are only available in the following places:
13873(Langholm), 15242(Hornby), 15394(Hawkshead), 15395(Grange-Over-Sands),
15396(Sedbergh), 16973(Wigton), 16974(Raughton Head), 16977(Brampton),
17683(Appleby), 17684(Pooley Bridge), 17687(Keswick), 19467(Gosforth) -->
<numberFormat pattern="(\d{5})(\d{4,5})"> <numberFormat pattern="(\d{5})(\d{4,5})">
<leadingDigits>1(?:38|5[23]|69|76|94)</leadingDigits> <leadingDigits>1(?:38|5[23]|69|76|94)</leadingDigits>
<leadingDigits>1(?:387|5(?:24|39)|697|768|946)</leadingDigits> <leadingDigits>1(?:387|5(?:24|39)|697|768|946)</leadingDigits>
<leadingDigits>1(?:3873|5(?:242|39[4-6])|697[347]|768[347]|9467)</leadingDigits>
<leadingDigits>1(?:3873|5(?:242|39[456])|697[347]|768[347]|9467)</leadingDigits>
<format>$1 $2</format> <format>$1 $2</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(1\d{3})(\d{4,6})">
<!-- 1ddd with 9 or 10 digits -->
<numberFormat pattern="(1\d{3})(\d{5,6})">
<leadingDigits>1</leadingDigits> <leadingDigits>1</leadingDigits>
<format>$1 $2</format> <format>$1 $2</format>
</numberFormat> </numberFormat>
<!-- http://online.vodafone.co.uk/dispatch/Portal/appmanager/vodafone/wrp?_nfpb=true&_pageLabel=Page_BOS_ContactUsContent&pageID=PCU_0001 -->
<numberFormat pattern="(7\d{3})(\d{3})(\d{3})">
<leadingDigits>7[1-9]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(70\d{2})(\d{6})">
<leadingDigits>70</leadingDigits>
<!-- 7ddd (not 70, 76) with 10 digits -->
<numberFormat pattern="(7\d{3})(\d{6})">
<leadingDigits>7[1-5789]</leadingDigits>
<format>$1 $2</format> <format>$1 $2</format>
</numberFormat> </numberFormat>
<!-- UK child line -->
<!-- 800 1111 : UK ChildLine -->
<numberFormat pattern="(800)(\d{4})"> <numberFormat pattern="(800)(\d{4})">
<leadingDigits>800</leadingDigits> <leadingDigits>800</leadingDigits>
<leadingDigits>8001</leadingDigits> <leadingDigits>8001</leadingDigits>
@ -2668,47 +2729,95 @@
<leadingDigits>8001111</leadingDigits> <leadingDigits>8001111</leadingDigits>
<format>$1 $2</format> <format>$1 $2</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(8\d{2})(\d{3})(\d{3,4})">
<leadingDigits>8(?:0|4[3-5]|7[0-3])</leadingDigits>
<!-- 845 46 47 : UK NHS Direct -->
<numberFormat pattern="(845)(46)(4\d)">
<leadingDigits>845</leadingDigits>
<leadingDigits>8454</leadingDigits>
<leadingDigits>84546</leadingDigits>
<leadingDigits>845464</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<!-- 84d, 87d with 10 digits -->
<numberFormat pattern="(8\d{2})(\d{3})(\d{4})">
<leadingDigits>8(?:4[2-5]|7[0-3])</leadingDigits>
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
<!-- 80d (including 800) with 10 digits -->
<numberFormat pattern="(80\d)(\d{3})(\d{4})">
<leadingDigits>80</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<!-- 500, 800 with 9 digits -->
<numberFormat pattern="([58]00)(\d{6})">
<leadingDigits>[58]00</leadingDigits>
<format>$1 $2</format>
</numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<nationalNumberPattern>\d{7,10}</nationalNumberPattern> <nationalNumberPattern>\d{7,10}</nationalNumberPattern>
<possibleNumberPattern>\d{6,10}</possibleNumberPattern>
<possibleNumberPattern>\d{4,10}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<!-- http://en.wikipedia.org/wiki/List_of_United_Kingdom_dialling_codes --> <!-- http://en.wikipedia.org/wiki/List_of_United_Kingdom_dialling_codes -->
<nationalNumberPattern>1(?:1[3-8]|[2-69]1)\d{7}|1(?:2(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|8[02-9]|9[0-9])|3(?:0\d|[25][02-9]|3[02-579]|4[0-56-9]|[68][0-46-9]|7[1-35-79]|9[24578])|4(?:0[03-9]|2[02-57-9]|[37]\d|4[02-69]|5[0-8]|[69][0-79]|8[02-9])|5(?:0[1-35-9]|2[024-9]|3[015689]|4[02-9]|[57][03-9]|6\d|8[0-68]|9[0-57-9])|6(?:0[034689]|2[0-35689]|3[13-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|8[013-9]|9[0-24578])|7(?:0[0246-9]|2\d|3[0236-8]|4[03-9]|5[0-46-9]|6[13-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\d|8[2-9]|9[02569])|9(?:0[02-589]|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|8\d|9[2-57]))\d{5,6}|(?:2[03489]|3[0347]|55)\d{8}</nationalNumberPattern>
<!-- Pattern matches all area codes with NSN=10, and all area code and local number
initial digits with NSN=9; excluding ranges used in GG, IM, JE -->
<nationalNumberPattern>1(?:1[3-8]|[2-69]1)\d{7}|
1(?:2(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-4789]|7[013-9]|9\d)|
3(?:0\d|[25][02-9]|3[02-579]|[468][0-46-9]|7[1235679]|9[24578])|
4(?:0[03-9]|2[02-5789]|[37]\d|4[02-69]|5[0-8]|[69][0-79]|8[02-5789])|
5(?:0[1235-9]|2[024-9]|3[015689]|4[02-9]|5[03-9]|6\d|7[0-35-9]|8[0-468]|9[0-5789])|
6(?:0[034689]|2[0-35689]|3[013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|8[013-9]|9[0124578])|
7(?:0[0246-9]|2\d|3[023678]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|
8(?:0[35-9]|2[1-5789]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\d|8[02-9]|9[02569])|
9(?:0[02-589]|2[02-689]|3[1-5789]|4[2-9]|5[0-579]|6[234789]|7[0124578]|8\d|9[2-57]))\d{6}|
1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-4789]|8[345])))|
3(?:638[2-5]|647[23]|8(?:47[04-9]|64[015789]))|
4(?:044[1-7]|20(?:2[23]|8\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[123]))|
5(?:24(?:3[2-79]|6\d)|276\d|6(?:26[06-9]|686))|
6(?:06(?:4\d|7[4-79])|295[567]|35[34]\d|47(?:24|61)|59(?:5[08]|6[67]|74)|955[0-4])|
7(?:26(?:6[13-9]|7[0-7])|442\d|50(?:2[0-3]|[3-68]2|76))|
8(?:27[56]\d|37(?:5[2-5]|8[239])|84(?:3[2-58]))|
9(?:0(?:0(?:6[1-8]|85)|52\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\d{3}|
176888[234678]\d{2}|
16977[23]\d{3}|
2(?:0[01378]|3[0189]|4[017]|8[0-46-9]|9[012])\d{7}|
(?:3[0347]|55)\d{8}</nationalNumberPattern>
<exampleNumber>1212345678</exampleNumber> <exampleNumber>1212345678</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<!-- http://www.ofcom.org.uk/telecoms/ioi/numbers/numbers_administered
-->
<nationalNumberPattern>7(?:4[0-26]\d|5(?:[013-9]\d|2[0-35-9])|7(?:0[1-9]|8[02-9]|9[0-689]|[1-7]\d)|8(?:[014-9]\d|[23][0-8])|9(?:1[02-9]|2[0135-9]|3[0-689]|[04-9]\d))\d{6}</nationalNumberPattern>
<!-- http://stakeholders.ofcom.org.uk/telecoms/numbering/telephone-no-availability/numbers-administered/
7100-7599 and 7700-7999 with 10 digits; excluding ranges used in GG, IM, JE -->
<nationalNumberPattern>7(?:[1-4]\d\d|5(?:0[0-8]|[13-9]\d|2[0-35-9])|7(?:0[1-9]|[1-7]\d|8[02-9]|9[0-689])|8(?:[014-9]\d|[23][0-8])|9(?:[04-9]\d|1[02-9]|2[0135-9]|3[0-689]))\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7400123456</exampleNumber> <exampleNumber>7400123456</exampleNumber>
</mobile> </mobile>
<pager>
<!-- 76 with 10 digits; excluding ranges used in IM -->
<nationalNumberPattern>76(?:0[012]|2[356]|4[0134]|5[49]|6[0-369]|77|81|9[39])\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7640123456</exampleNumber>
</pager>
<!-- Source for non geographic numbers: <!-- Source for non geographic numbers:
http://en.wikipedia.org/wiki/Non-geographical_telephone_numbers_in_the_UK
-->
http://en.wikipedia.org/wiki/Non-geographical_telephone_numbers_in_the_UK -->
<tollFree> <tollFree>
<nationalNumberPattern>80(?:01111|\d{7,8})|500\d{6}</nationalNumberPattern>
<!-- 800 1111 with 7 digits, 800 with 9 or 10 digits, 808 with 10 digits, 500 with 9 digits. -->
<nationalNumberPattern>80(?:0(?:1111|\d{6,7})|8\d{7})|500\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern> <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
<exampleNumber>8012345678</exampleNumber>
<exampleNumber>8001234567</exampleNumber>
</tollFree> </tollFree>
<premiumRate> <premiumRate>
<!-- 0871, 0872 and 0873 are now Controlled Premium Rate Services, so
are listed here. -->
<nationalNumberPattern>(?:9[018]\d|87[1-3])\d{7}</nationalNumberPattern>
<!-- 871, 872 and 873 are now Controlled Premium Rate Services,
so are listed here as well as 900-909, 910-919, 980-983 -->
<nationalNumberPattern>(?:87[123]|9(?:[01]\d|8[0-3]))\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>9012345678</exampleNumber> <exampleNumber>9012345678</exampleNumber>
</premiumRate> </premiumRate>
<!-- Using shared cost to deal with the various revenue sharing number
prefixes in the United Kingdom. -->
<sharedCost> <sharedCost>
<nationalNumberPattern>8(?:4[3-5]|70)\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<!-- Using shared cost to deal with the various revenue sharing
number prefixes in the United Kingdom
845 46 47 with 7 digits, 842-845, 870 with 10 digits -->
<nationalNumberPattern>8(?:4(?:5464\d|[2-5]\d{7})|70\d{7})</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern>
<exampleNumber>8431234567</exampleNumber> <exampleNumber>8431234567</exampleNumber>
</sharedCost> </sharedCost>
<personalNumber> <personalNumber>
@ -2812,17 +2921,17 @@
<!-- Guernsey --> <!-- Guernsey -->
<!-- Inherits formatting rules from the UK. --> <!-- Inherits formatting rules from the UK. -->
<!-- http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom
-->
<!-- http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom -->
<territory id="GG" countryCode="44" internationalPrefix="00" <territory id="GG" countryCode="44" internationalPrefix="00"
nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG"> nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG">
<generalDesc> <generalDesc>
<nationalNumberPattern>[157-9]\d{6,9}</nationalNumberPattern>
<nationalNumberPattern>[15789]\d{6,9}</nationalNumberPattern>
<possibleNumberPattern>\d{6,10}</possibleNumberPattern> <possibleNumberPattern>\d{6,10}</possibleNumberPattern>
</generalDesc> </generalDesc>
<!-- Specific to GG. -->
<fixedLine> <fixedLine>
<nationalNumberPattern>1481\d{6}</nationalNumberPattern> <nationalNumberPattern>1481\d{6}</nationalNumberPattern>
<exampleNumber>1481223456</exampleNumber>
<exampleNumber>1481456789</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<nationalNumberPattern>7(?:781|839|911)\d{6}</nationalNumberPattern> <nationalNumberPattern>7(?:781|839|911)\d{6}</nationalNumberPattern>
@ -2830,13 +2939,18 @@
<exampleNumber>7781123456</exampleNumber> <exampleNumber>7781123456</exampleNumber>
</mobile> </mobile>
<!-- Other numbers as per GB. --> <!-- Other numbers as per GB. -->
<pager>
<nationalNumberPattern>76(?:0[012]|2[356]|4[0134]|5[49]|6[0-369]|77|81|9[39])\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7640123456</exampleNumber>
</pager>
<tollFree> <tollFree>
<nationalNumberPattern>80(?:01111|\d{7,8})|500\d{6}</nationalNumberPattern>
<nationalNumberPattern>80(?:0(?:1111|\d{6,7})|8\d{7})|500\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern> <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
<exampleNumber>8001234567</exampleNumber> <exampleNumber>8001234567</exampleNumber>
</tollFree> </tollFree>
<premiumRate> <premiumRate>
<nationalNumberPattern>(?:9[018]\d|87[1-3])\d{7}</nationalNumberPattern>
<nationalNumberPattern>(?:87[123]|9(?:[01]\d|8[0-3]))\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>9012345678</exampleNumber> <exampleNumber>9012345678</exampleNumber>
</premiumRate> </premiumRate>
@ -2950,7 +3064,7 @@
</numberFormat> </numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<nationalNumberPattern>[367]\d{7}</nationalNumberPattern>
<nationalNumberPattern>[3567]\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{8}</possibleNumberPattern> <possibleNumberPattern>\d{8}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
@ -2961,7 +3075,7 @@
<!-- WiMAX is in the plan - which is a wireless broadband protocol. Not <!-- WiMAX is in the plan - which is a wireless broadband protocol. Not
including this in the metadata for now unless this proves to be including this in the metadata for now unless this proves to be
necessary. These would start with 79. --> necessary. These would start with 79. -->
<nationalNumberPattern>6(?:0(?:2\d|3[3467]|5[2457-9])|[2457]\d{2}|3(?:[14]0|35))\d{4}</nationalNumberPattern>
<nationalNumberPattern>55\d{6}|6(?:0(?:2\d|3[3467]|5[2457-9])|[2457]\d{2}|3(?:[14]0|35))\d{4}</nationalNumberPattern>
<exampleNumber>60201234</exampleNumber> <exampleNumber>60201234</exampleNumber>
</mobile> </mobile>
</territory> </territory>
@ -3579,36 +3693,42 @@
<!-- Isle of Man --> <!-- Isle of Man -->
<!-- Inherits formatting rules from the UK. --> <!-- Inherits formatting rules from the UK. -->
<!-- http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom
-->
<!-- http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom -->
<territory id="IM" countryCode="44" internationalPrefix="00" <territory id="IM" countryCode="44" internationalPrefix="00"
nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG"> nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG">
<generalDesc> <generalDesc>
<nationalNumberPattern>[157-9]\d{6,9}</nationalNumberPattern>
<nationalNumberPattern>[15789]\d{6,9}</nationalNumberPattern>
<possibleNumberPattern>\d{6,10}</possibleNumberPattern> <possibleNumberPattern>\d{6,10}</possibleNumberPattern>
</generalDesc> </generalDesc>
<!-- Specific to IM. -->
<fixedLine> <fixedLine>
<nationalNumberPattern>1624\d{6}</nationalNumberPattern> <nationalNumberPattern>1624\d{6}</nationalNumberPattern>
<exampleNumber>1624223456</exampleNumber>
<exampleNumber>1624456789</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<nationalNumberPattern>7[69]24\d{6}</nationalNumberPattern>
<exampleNumber>7624123456</exampleNumber>
<nationalNumberPattern>7[569]24\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7924123456</exampleNumber>
</mobile> </mobile>
<pager>
<nationalNumberPattern>7624\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7624123456</exampleNumber>
</pager>
<!-- Other numbers as per GB. --> <!-- Other numbers as per GB. -->
<tollFree> <tollFree>
<nationalNumberPattern>80(?:01111|\d{7,8})|500\d{6}</nationalNumberPattern>
<nationalNumberPattern>80(?:0(?:1111|\d{6,7})|8\d{7})|500\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern> <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
<exampleNumber>8001234567</exampleNumber> <exampleNumber>8001234567</exampleNumber>
</tollFree> </tollFree>
<premiumRate> <premiumRate>
<nationalNumberPattern>(?:9[018]\d|87[1-3])\d{7}</nationalNumberPattern>
<nationalNumberPattern>(?:87[123]|9(?:[01]\d|8[0-3]))\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>9012345678</exampleNumber> <exampleNumber>9012345678</exampleNumber>
</premiumRate> </premiumRate>
<sharedCost> <sharedCost>
<nationalNumberPattern>8(?:4[3-5]|70)\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<nationalNumberPattern>8(?:4(?:5464\d|[2-5]\d{7})|70\d{7})</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern>
<exampleNumber>8431234567</exampleNumber> <exampleNumber>8431234567</exampleNumber>
</sharedCost> </sharedCost>
<personalNumber> <personalNumber>
@ -3819,32 +3939,41 @@
<territory id="IS" countryCode="354" internationalPrefix="00"> <territory id="IS" countryCode="354" internationalPrefix="00">
<availableFormats> <availableFormats>
<numberFormat pattern="(\d{3})(\d{4})"> <numberFormat pattern="(\d{3})(\d{4})">
<leadingDigits>[4-9]</leadingDigits>
<format>$1 $2</format> <format>$1 $2</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(3\d{2})(\d{3})(\d{3})">
<leadingDigits>3</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<nationalNumberPattern>[4-9]\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{7}</possibleNumberPattern>
<nationalNumberPattern>[4-9]\d{6}|38\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{7,9}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<!-- Including 87[23] XXXX here as it is listed as a fax number. --> <!-- Including 87[23] XXXX here as it is listed as a fax number. -->
<nationalNumberPattern>(?:4(?:1[0-245]|2[0-7]|[37][0-8]|4[0245]|5[0-356]|6\d|8[0-46-8]|9[013-79])|5(?:05|[156]\d|2[02578]|3[013-6]|4[03-6]|7[0-2578]|8[0-25-9]|9[013-689])|87[23])\d{4}</nationalNumberPattern> <nationalNumberPattern>(?:4(?:1[0-245]|2[0-7]|[37][0-8]|4[0245]|5[0-356]|6\d|8[0-46-8]|9[013-79])|5(?:05|[156]\d|2[02578]|3[013-6]|4[03-6]|7[0-2578]|8[0-25-9]|9[013-689])|87[23])\d{4}</nationalNumberPattern>
<possibleNumberPattern>\d{7}</possibleNumberPattern>
<exampleNumber>4101234</exampleNumber> <exampleNumber>4101234</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<nationalNumberPattern>(?:6(?:1[014-8]|2[0-8]|3[0-27-9]|4[0-29]|5[029]|[67][0-69]|[89]\d)|7(?:5[057]|7[0-7])|8(?:2[0-5]|[469]\d|5[1-9]))\d{4}</nationalNumberPattern>
<nationalNumberPattern>38[59]\d{6}|(?:6(?:1[014-8]|2[0-8]|3[0-27-9]|4[0-29]|5[029]|[67][0-69]|[89]\d)|7(?:5[057]|7[0-7])|8(?:2[0-5]|[469]\d|5[1-9]))\d{4}</nationalNumberPattern>
<exampleNumber>6101234</exampleNumber> <exampleNumber>6101234</exampleNumber>
</mobile> </mobile>
<tollFree> <tollFree>
<nationalNumberPattern>800\d{4}</nationalNumberPattern> <nationalNumberPattern>800\d{4}</nationalNumberPattern>
<possibleNumberPattern>\d{7}</possibleNumberPattern>
<exampleNumber>8001234</exampleNumber> <exampleNumber>8001234</exampleNumber>
</tollFree> </tollFree>
<premiumRate> <premiumRate>
<nationalNumberPattern>90\d{5}</nationalNumberPattern> <nationalNumberPattern>90\d{5}</nationalNumberPattern>
<possibleNumberPattern>\d{7}</possibleNumberPattern>
<exampleNumber>9011234</exampleNumber> <exampleNumber>9011234</exampleNumber>
</premiumRate> </premiumRate>
<voip> <voip>
<nationalNumberPattern>49[013-79]\d{4}</nationalNumberPattern> <nationalNumberPattern>49[013-79]\d{4}</nationalNumberPattern>
<possibleNumberPattern>\d{7}</possibleNumberPattern>
<exampleNumber>4931234</exampleNumber> <exampleNumber>4931234</exampleNumber>
</voip> </voip>
</territory> </territory>
@ -3935,44 +4064,51 @@
<!-- Jersey --> <!-- Jersey -->
<!-- Inherits formatting rules from the UK. --> <!-- Inherits formatting rules from the UK. -->
<!-- http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom
-->
<!-- http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom -->
<territory id="JE" countryCode="44" internationalPrefix="00" <territory id="JE" countryCode="44" internationalPrefix="00"
nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG"> nationalPrefix="0" preferredExtnPrefix=" x" nationalPrefixFormattingRule="$NP$FG">
<generalDesc> <generalDesc>
<nationalNumberPattern>[157-9]\d{6,9}</nationalNumberPattern>
<nationalNumberPattern>[15789]\d{6,9}</nationalNumberPattern>
<possibleNumberPattern>\d{6,10}</possibleNumberPattern> <possibleNumberPattern>\d{6,10}</possibleNumberPattern>
</generalDesc> </generalDesc>
<!-- Specific to JE. -->
<fixedLine> <fixedLine>
<nationalNumberPattern>1534\d{6}</nationalNumberPattern> <nationalNumberPattern>1534\d{6}</nationalNumberPattern>
<exampleNumber>1534223456</exampleNumber>
<exampleNumber>1534456789</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<nationalNumberPattern>7(?:7(?:00|97)|829|937)\d{6}</nationalNumberPattern>
<nationalNumberPattern>7(?:509|7(?:00|97)|829|937)\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7797123456</exampleNumber> <exampleNumber>7797123456</exampleNumber>
</mobile> </mobile>
<!-- Other numbers as per GB. --> <!-- Other numbers as per GB. -->
<pager>
<nationalNumberPattern>76(?:0[012]|2[356]|4[0134]|5[49]|6[0-369]|77|81|9[39])\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7640123456</exampleNumber>
</pager>
<tollFree> <tollFree>
<nationalNumberPattern>80(?:01111|\d{7,8})|500\d{6}</nationalNumberPattern>
<nationalNumberPattern>80(?:0(?:1111|\d{6,7})|8\d{7})|500\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern> <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
<exampleNumber>8001234567</exampleNumber> <exampleNumber>8001234567</exampleNumber>
</tollFree> </tollFree>
<premiumRate> <premiumRate>
<nationalNumberPattern>(?:9[018]\d|87[1-3])\d{7}</nationalNumberPattern>
<nationalNumberPattern>(?:87[123]|9(?:[01]\d|8[0-3]))\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>9012345678</exampleNumber> <exampleNumber>9012345678</exampleNumber>
</premiumRate> </premiumRate>
<sharedCost> <sharedCost>
<nationalNumberPattern>8(?:4[3-5]|70)\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<nationalNumberPattern>8(?:4(?:5464\d|[2-5]\d{7})|70\d{7})</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern>
<exampleNumber>8431234567</exampleNumber> <exampleNumber>8431234567</exampleNumber>
</sharedCost> </sharedCost>
<!-- Specific to JE. -->
<personalNumber> <personalNumber>
<nationalNumberPattern>70\d{8}</nationalNumberPattern>
<nationalNumberPattern>701511\d{4}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>7012345678</exampleNumber>
<exampleNumber>7015115678</exampleNumber>
</personalNumber> </personalNumber>
<!-- Other numbers as per GB. -->
<voip> <voip>
<nationalNumberPattern>56\d{8}</nationalNumberPattern> <nationalNumberPattern>56\d{8}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
@ -4078,7 +4214,7 @@
<!-- Toll-free numbers --> <!-- Toll-free numbers -->
<numberFormat pattern="(\d{3})(\d{3})(\d{3})"> <numberFormat pattern="(\d{3})(\d{3})(\d{3})">
<leadingDigits>(?:12|99)0</leadingDigits> <leadingDigits>(?:12|99)0</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
<!-- Some leading digits are explicitly reserved for a particular purpose. <!-- Some leading digits are explicitly reserved for a particular purpose.
We handle them first in this rule, and let the following rules ignore those exceptions. We handle them first in this rule, and let the following rules ignore those exceptions.
@ -4095,7 +4231,7 @@
--> -->
<numberFormat pattern="(\d{2})(\d{4})(\d{4})"> <numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>[57-9]0</leadingDigits> <leadingDigits>[57-9]0</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
<!-- The order of the reg-exps are important. <!-- The order of the reg-exps are important.
Examples (not all): Examples (not all):
@ -4110,32 +4246,32 @@
<leadingDigits>1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|5(?:76|97)|499|746|8(?:3[89]|63|47|51)|9(?:49|80|9[16])</leadingDigits> <leadingDigits>1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|5(?:76|97)|499|746|8(?:3[89]|63|47|51)|9(?:49|80|9[16])</leadingDigits>
<leadingDigits>1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|5(?:76|97)9|499[2468]|7468|8(?:3(?:8[78]|96)|636|477|51[24])|9(?:496|802|9(?:1[23]|69))</leadingDigits> <leadingDigits>1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|5(?:76|97)9|499[2468]|7468|8(?:3(?:8[78]|96)|636|477|51[24])|9(?:496|802|9(?:1[23]|69))</leadingDigits>
<leadingDigits>1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|5(?:769|979[2-69])|499[2468]|7468|8(?:3(?:8[78]|96[2457-9])|636[2-57-9]|477|51[24])|9(?:496|802|9(?:1[23]|69))</leadingDigits> <leadingDigits>1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|5(?:769|979[2-69])|499[2468]|7468|8(?:3(?:8[78]|96[2457-9])|636[2-57-9]|477|51[24])|9(?:496|802|9(?:1[23]|69))</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(\d{3})(\d{2})(\d{4})"> <numberFormat pattern="(\d{3})(\d{2})(\d{4})">
<leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5[2-8]|[68][2-7]|7[2-689]|9[1-578])|2(?:2[034-9]|3[3-58]|4[0-468]|5[04-8]|6[013-8]|7[06-9]|8[02-57-9]|9[13])|4(?:2[28]|3[689]|6[035-7]|7[05689]|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9[4-9])|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9[014-9])|8(?:2[49]|3[3-8]|4[5-8]|5[2-9]|6[35-9]|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9[3-7])</leadingDigits> <leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5[2-8]|[68][2-7]|7[2-689]|9[1-578])|2(?:2[034-9]|3[3-58]|4[0-468]|5[04-8]|6[013-8]|7[06-9]|8[02-57-9]|9[13])|4(?:2[28]|3[689]|6[035-7]|7[05689]|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9[4-9])|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9[014-9])|8(?:2[49]|3[3-8]|4[5-8]|5[2-9]|6[35-9]|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9[3-7])</leadingDigits>
<leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-9]|3[23])|3[3-58]|4[0-468]|5(?:5[78]|7[2-4]|[0468][2-9])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[89][2-8]|[4-7]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9[2-8])|3(?:7[2-56]|[3-6][2-9]|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5[4-7]|6[2-9]|8[2-8]|9[236-9])|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3[34]|[4-7]))</leadingDigits> <leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-9]|3[23])|3[3-58]|4[0-468]|5(?:5[78]|7[2-4]|[0468][2-9])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[89][2-8]|[4-7]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9[2-8])|3(?:7[2-56]|[3-6][2-9]|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5[4-7]|6[2-9]|8[2-8]|9[236-9])|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3[34]|[4-7]))</leadingDigits>
<leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-9]|3[23])|3[3-58]|4[0-468]|5(?:5[78]|7[2-4]|[0468][2-9])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[89][2-8]|[4-7]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9(?:[3578]|20|4[04-9]|6[56]))|3(?:7(?:[2-5]|6[0-59])|[3-6][2-9]|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5(?:[467]|5[014-9])|6(?:[2-8]|9[02-69])|8[2-8]|9(?:[236-8]|9[23]))|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3(?:3[02-9]|4[0-24689])|4[2-69]|[5-7]))</leadingDigits> <leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-9]|3[23])|3[3-58]|4[0-468]|5(?:5[78]|7[2-4]|[0468][2-9])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[89][2-8]|[4-7]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9(?:[3578]|20|4[04-9]|6[56]))|3(?:7(?:[2-5]|6[0-59])|[3-6][2-9]|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5(?:[467]|5[014-9])|6(?:[2-8]|9[02-69])|8[2-8]|9(?:[236-8]|9[23]))|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3(?:3[02-9]|4[0-24689])|4[2-69]|[5-7]))</leadingDigits>
<leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-9]|3[23])|3[3-58]|4[0-468]|5(?:5[78]|7[2-4]|[0468][2-9])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[89][2-8]|[4-7]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9(?:[3578]|20|4[04-9]|6(?:5[25]|60)))|3(?:7(?:[2-5]|6[0-59])|[3-6][2-9]|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5(?:[467]|5[014-9])|6(?:[2-8]|9[02-69])|8[2-8]|9(?:[236-8]|9[23]))|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3(?:3[02-9]|4[0-24689])|4[2-69]|[5-7]))</leadingDigits> <leadingDigits>1(?:2[3-6]|3[3-9]|4[2-6]|5(?:[236-8]|[45][2-69])|[68][2-7]|7[2-689]|9[1-578])|2(?:2(?:[04-9]|3[23])|3[3-58]|4[0-468]|5(?:5[78]|7[2-4]|[0468][2-9])|6(?:[0135-8]|4[2-5])|7(?:[0679]|8[2-7])|8(?:[024578]|3[25-9]|9[6-9])|9(?:11|3[2-4]))|4(?:2(?:2[2-9]|8[237-9])|3[689]|6[035-7]|7(?:[059][2-8]|[68])|80|9[3-5])|5(?:3[1-36-9]|4[4578]|5[013-8]|6[1-9]|7[2-8]|8[14-7]|9(?:[89][2-8]|[4-7]))|7(?:2[15]|3[5-9]|4[02-9]|6[135-8]|7[0-4689]|9(?:[017-9]|4[6-8]|5[2-478]|6[2-589]))|8(?:2(?:4[4-8]|9(?:[3578]|20|4[04-9]|6(?:5[25]|60)))|3(?:7(?:[2-5]|6[0-59])|[3-6][2-9]|8[2-5])|4[5-8]|5[2-9]|6(?:[37]|5(?:[467]|5[014-9])|6(?:[2-8]|9[02-69])|8[2-8]|9(?:[236-8]|9[23]))|7[579]|8[03-579]|9[2-8])|9(?:[23]0|4[02-46-9]|5[0245-79]|6[4-9]|7[2-47-9]|8[02-7]|9(?:3(?:3[02-9]|4[0-24689])|4[2-69]|[5-7]))</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(\d{2})(\d{3})(\d{4})"> <numberFormat pattern="(\d{2})(\d{3})(\d{4})">
<leadingDigits>1|2(?:23|5[5-89]|64|78|8[39]|91)|4(?:2[2689]|64|7[347])|5(?:[2-589]|39)|8(?:[46-9]|3[279]|2[124589])|9(?:[235-8]|93)</leadingDigits> <leadingDigits>1|2(?:23|5[5-89]|64|78|8[39]|91)|4(?:2[2689]|64|7[347])|5(?:[2-589]|39)|8(?:[46-9]|3[279]|2[124589])|9(?:[235-8]|93)</leadingDigits>
<leadingDigits>1|2(?:23|5(?:[57]|[68]0|9[19])|64|78|8[39]|917)|4(?:2(?:[68]|20|9[178])|64|7[347])|5(?:[2-589]|39[67])|8(?:[46-9]|3[279]|2[124589])|9(?:[235-8]|93[34])</leadingDigits> <leadingDigits>1|2(?:23|5(?:[57]|[68]0|9[19])|64|78|8[39]|917)|4(?:2(?:[68]|20|9[178])|64|7[347])|5(?:[2-589]|39[67])|8(?:[46-9]|3[279]|2[124589])|9(?:[235-8]|93[34])</leadingDigits>
<leadingDigits>1|2(?:23|5(?:[57]|[68]0|9(?:17|99))|64|78|8[39]|917)|4(?:2(?:[68]|20|9[178])|64|7[347])|5(?:[2-589]|39[67])|8(?:[46-9]|3[279]|2[124589])|9(?:[235-8]|93(?:31|4))</leadingDigits> <leadingDigits>1|2(?:23|5(?:[57]|[68]0|9(?:17|99))|64|78|8[39]|917)|4(?:2(?:[68]|20|9[178])|64|7[347])|5(?:[2-589]|39[67])|8(?:[46-9]|3[279]|2[124589])|9(?:[235-8]|93(?:31|4))</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(\d{3})(\d{2})(\d{4})"> <numberFormat pattern="(\d{3})(\d{2})(\d{4})">
<leadingDigits>2(?:9[14-79]|74|[34]7|[56]9)|82|993</leadingDigits> <leadingDigits>2(?:9[14-79]|74|[34]7|[56]9)|82|993</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(\d)(\d{4})(\d{4})"> <numberFormat pattern="(\d)(\d{4})(\d{4})">
<leadingDigits>[36]|4(?:2[09]|7[01])</leadingDigits> <leadingDigits>[36]|4(?:2[09]|7[01])</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(\d{2})(\d{3})(\d{4})"> <numberFormat pattern="(\d{2})(\d{3})(\d{4})">
<leadingDigits>[2479]</leadingDigits> <leadingDigits>[2479]</leadingDigits>
<format>$1 $2 $3</format>
<format>$1-$2-$3</format>
</numberFormat> </numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
@ -4428,13 +4564,21 @@
<leadingDigits>[3-9][1-9]1(?:[0-46-9])</leadingDigits> <leadingDigits>[3-9][1-9]1(?:[0-46-9])</leadingDigits>
<format>$1-$2</format> <format>$1-$2</format>
</numberFormat> </numberFormat>
<!-- Company numbers.-->
<numberFormat pattern="(\d{4})(\d{4})"
nationalPrefixFormattingRule="$FG">
<leadingDigits>1(?:5[46-9]|6[04678])</leadingDigits>
<leadingDigits>1(?:5(?:44|66|77|88|99)|6(?:00|44|6[16]|70|88))</leadingDigits>
<format>$1-$2</format>
</numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<nationalNumberPattern>[1-79]\d{3,9}|8\d{8}</nationalNumberPattern> <nationalNumberPattern>[1-79]\d{3,9}|8\d{8}</nationalNumberPattern>
<possibleNumberPattern>\d{4,10}</possibleNumberPattern> <possibleNumberPattern>\d{4,10}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<nationalNumberPattern>(?:2|[34][1-3]|5[1-5]|6[1-4])(?:1\d{2,3}|[2-9]\d{6,7})</nationalNumberPattern>
<!-- 8-digit company numbers have been included here as well.-->
<nationalNumberPattern>1(?:5(?:44|66|77|88|99)|6(?:00|44|6[16]|70|88))\d{4}|(?:2|[34][1-3]|5[1-5]|6[1-4])(?:1\d{2,3}|[2-9]\d{6,7})</nationalNumberPattern>
<possibleNumberPattern>\d{4,10}</possibleNumberPattern> <possibleNumberPattern>\d{4,10}</possibleNumberPattern>
<exampleNumber>22123456</exampleNumber> <exampleNumber>22123456</exampleNumber>
</fixedLine> </fixedLine>
@ -4485,7 +4629,7 @@
<possibleNumberPattern>\d{7,8}</possibleNumberPattern> <possibleNumberPattern>\d{7,8}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<nationalNumberPattern>(?:18|2[2-5]\d)\d{5}</nationalNumberPattern>
<nationalNumberPattern>(?:18\d|2(?:[23]\d{2}|4[1-35-9]\d|5(?:0[034]|[2-46]\d|5[1-3]|7[1-7])))\d{4}</nationalNumberPattern>
<possibleNumberPattern>\d{7,8}</possibleNumberPattern> <possibleNumberPattern>\d{7,8}</possibleNumberPattern>
<exampleNumber>22345678</exampleNumber> <exampleNumber>22345678</exampleNumber>
</fixedLine> </fixedLine>
@ -5680,7 +5824,8 @@
<exampleNumber>20201234</exampleNumber> <exampleNumber>20201234</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<!-- Added 90 and 97 from online data. -->
<!-- Added 90 and 97 from online data. Zain have confirmed that they use
the 97 prefix. -->
<nationalNumberPattern>9[03467]\d{6}</nationalNumberPattern> <nationalNumberPattern>9[03467]\d{6}</nationalNumberPattern>
<exampleNumber>93123456</exampleNumber> <exampleNumber>93123456</exampleNumber>
</mobile> </mobile>
@ -6049,39 +6194,35 @@
nationalPrefix="0" nationalPrefixFormattingRule="($FG)" nationalPrefix="0" nationalPrefixFormattingRule="($FG)"
preferredExtnPrefix=" Anexo "> preferredExtnPrefix=" Anexo ">
<availableFormats> <availableFormats>
<numberFormat pattern="(1)(9\d{2})(\d{6})">
<leadingDigits>19</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(1)(\d{8})">
<leadingDigits>1[0-8]</leadingDigits>
<numberFormat pattern="(1)(\d{7})">
<leadingDigits>1</leadingDigits>
<format>$1 $2</format> <format>$1 $2</format>
</numberFormat> </numberFormat>
<numberFormat pattern="([4-8]\d)(\d{6})"> <numberFormat pattern="([4-8]\d)(\d{6})">
<leadingDigits>[4-8]\d[0-8]</leadingDigits>
<leadingDigits>[4-8]</leadingDigits>
<format>$1 $2</format> <format>$1 $2</format>
</numberFormat> </numberFormat>
<numberFormat pattern="([4-8]\d)(9\d{2})(\d{6})">
<leadingDigits>[4-8]\d9</leadingDigits>
<!-- Formatting from common usage found on the internet, supported by
ITU doc. -->
<numberFormat pattern="(9\d{2})(\d{3})(\d{3})"
nationalPrefixFormattingRule="$FG">
<leadingDigits>9</leadingDigits>
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<!-- The explicit requirements for numbers beginning with 5 are because
of the existence of a region code 51, not to be confused with the
country code 51. -->
<nationalNumberPattern>[146-8]\d{7,10}|5\d{7}(?:\d{3})?</nationalNumberPattern>
<possibleNumberPattern>\d{7,11}</possibleNumberPattern>
<nationalNumberPattern>[14-9]\d{7,8}</nationalNumberPattern>
<possibleNumberPattern>\d{6,9}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<nationalNumberPattern>(?:1\d{2}|4[1-4]|5[1-46]|6[1-7]|7[2-46]|8[2-4])\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{7,9}</possibleNumberPattern>
<exampleNumber>112345678</exampleNumber>
<nationalNumberPattern>(?:1\d|4[1-4]|5[1-46]|6[1-7]|7[2-46]|8[2-4])\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{6,8}</possibleNumberPattern>
<exampleNumber>11234567</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<nationalNumberPattern>(?:1|4[1-4]|5[1-46]|6[1-7]|7[2-46]|8[2-4])9\d{8}</nationalNumberPattern>
<possibleNumberPattern>\d{10,11}</possibleNumberPattern>
<exampleNumber>54951234567</exampleNumber>
<nationalNumberPattern>9\d{8}</nationalNumberPattern>
<possibleNumberPattern>\d{9}</possibleNumberPattern>
<exampleNumber>912345678</exampleNumber>
</mobile> </mobile>
</territory> </territory>
@ -6419,6 +6560,10 @@
<nationalNumberPattern>71\d{7}</nationalNumberPattern> <nationalNumberPattern>71\d{7}</nationalNumberPattern>
<exampleNumber>712345678</exampleNumber> <exampleNumber>712345678</exampleNumber>
</premiumRate> </premiumRate>
<sharedCost>
<nationalNumberPattern>808\d{6}</nationalNumberPattern>
<exampleNumber>808123456</exampleNumber>
</sharedCost>
<voip> <voip>
<nationalNumberPattern>30\d{7}</nationalNumberPattern> <nationalNumberPattern>30\d{7}</nationalNumberPattern>
<exampleNumber>301234567</exampleNumber> <exampleNumber>301234567</exampleNumber>
@ -6620,8 +6765,8 @@
<!-- Formatting from wikipedia, confirmed on Goverment websites such <!-- Formatting from wikipedia, confirmed on Goverment websites such
as http://www.minjust.ru/ru/structure/contact/. Contains formatting as http://www.minjust.ru/ru/structure/contact/. Contains formatting
instructions for Kazakhstan as well. --> instructions for Kazakhstan as well. -->
<numberFormat pattern="([34689]\d{2})(\d{3})(\d{2})(\d{2})">
<leadingDigits>[3489]</leadingDigits>
<numberFormat pattern="([3489]\d{2})(\d{3})(\d{2})(\d{2})">
<leadingDigits>[34689]</leadingDigits>
<format>$1 $2-$3-$4</format> <format>$1 $2-$3-$4</format>
</numberFormat> </numberFormat>
<numberFormat pattern="([67]\d{2})(\d{3})(\d{4})"> <numberFormat pattern="([67]\d{2})(\d{3})(\d{4})">
@ -6819,8 +6964,8 @@
<leadingDigits>1[2457]|2[2457-9]|3[0247-9]|4[1357-9]|5[0-35-9]|6[124-9]|9(?:[125-8]|3[0-5]|4[0-3])</leadingDigits> <leadingDigits>1[2457]|2[2457-9]|3[0247-9]|4[1357-9]|5[0-35-9]|6[124-9]|9(?:[125-8]|3[0-5]|4[0-3])</leadingDigits>
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(7[02-46])(\d{3})(\d{2})(\d{2})">
<leadingDigits>7[02-46]</leadingDigits>
<numberFormat pattern="(7[02-467])(\d{3})(\d{2})(\d{2})">
<leadingDigits>7[02-467]</leadingDigits>
<format>$1 $2 $3 $4</format> <format>$1 $2 $3 $4</format>
</numberFormat> </numberFormat>
<numberFormat pattern="(20)(\d{2,3})(\d{2})"> <numberFormat pattern="(20)(\d{2,3})(\d{2})">
@ -6856,6 +7001,11 @@
<possibleNumberPattern>\d{10}</possibleNumberPattern> <possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>9001234567</exampleNumber> <exampleNumber>9001234567</exampleNumber>
</premiumRate> </premiumRate>
<sharedCost>
<nationalNumberPattern>77\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{9}</possibleNumberPattern>
<exampleNumber>771234567</exampleNumber>
</sharedCost>
</territory> </territory>
<!-- Singapore --> <!-- Singapore -->
@ -7546,7 +7696,7 @@
<possibleNumberPattern>\d{7,10}</possibleNumberPattern> <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<nationalNumberPattern>868(?:22[1-4]|6(?:1[4-6]|[2-6]\d|7[0-79]|9[0-8])|82[12])\d{4}</nationalNumberPattern>
<nationalNumberPattern>868(?:2(?:01|2[1-4])|6(?:1[4-6]|2[1-9]|[3-6]\d|7[0-79]|9[0-8])|82[12])\d{4}</nationalNumberPattern>
<exampleNumber>8682211234</exampleNumber> <exampleNumber>8682211234</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
@ -8261,7 +8411,7 @@
</territory> </territory>
<!-- Zimbabwe --> <!-- Zimbabwe -->
<!-- http://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000E90001MSWE.doc -->
<!-- http://www.itu.int/oth/T02020000E9/en -->
<territory id="ZW" countryCode="263" internationalPrefix="00" <territory id="ZW" countryCode="263" internationalPrefix="00"
nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG"> nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
<availableFormats> <availableFormats>
@ -8271,7 +8421,7 @@
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
<!-- Mobile numbers --> <!-- Mobile numbers -->
<numberFormat pattern="([179]\d)(\d{3})(\d{3,5})">
<numberFormat pattern="([179]\d)(\d{3})(\d{3,4})">
<leadingDigits>[19]1|7</leadingDigits> <leadingDigits>[19]1|7</leadingDigits>
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
@ -8304,22 +8454,45 @@
<leadingDigits>258[23]|5483</leadingDigits> <leadingDigits>258[23]|5483</leadingDigits>
<format>$1 $2 $3</format> <format>$1 $2 $3</format>
</numberFormat> </numberFormat>
<!-- VOIP numbers -->
<numberFormat pattern="(8\d{3})(\d{6})">
<leadingDigits>8</leadingDigits>
<format>$1 $2</format>
</numberFormat>
</availableFormats> </availableFormats>
<generalDesc> <generalDesc>
<nationalNumberPattern>(?:[19]1|23)\d{3,8}|[1-69]\d{4,8}</nationalNumberPattern>
<!-- A complicated nationalNumberPattern is necessary here, since the
numbers are extremely variable in length and the possible prefixes clash
with the country code. -->
<nationalNumberPattern>
2(?:[012457-9]\d{3,8}|6\d{3,6})|
[13-79]\d{4,8}|
86\d{8}
</nationalNumberPattern>
<possibleNumberPattern>\d{3,10}</possibleNumberPattern> <possibleNumberPattern>\d{3,10}</possibleNumberPattern>
</generalDesc> </generalDesc>
<fixedLine> <fixedLine>
<nationalNumberPattern>(?:1[346-8]|2(?:0[45]|2[28]|48|58[23]|[69]|7[2-46-8]|8[13-9])|3(?:08?|17?|3[78]|[45]|7[1569]|8[379])|5(?:18|483|[57-9])|6(?:37?|[459]|88)|848)\d{3,6}|(?:2(?:27|5|7[159]|82)|39|5[346]|6[16-8])\d{4,6}|2(?:0|70)\d{5,6}|(?:9[2-8]|4\d)\d{4,7}</nationalNumberPattern>
<!-- Numbering is grouped by subscriber-number length.-->
<nationalNumberPattern>
(?:1[3-9]|2(?:0[45]|[16]|2[28]|[49]8?|58[23]|7[246]|8[1346-9])|3(?:08?|17?|3[78]|[2456]|7[1569]|8[379])|5(?:[07-9]|1[78]|483|5(?:7?|8))|6(?:0|28|37?|[45][68][78]|98?)|848)\d{3,6}|
(?:2(?:27|5|7[135789]|8[25])|3[39]|5[1-46]|6[126-8])\d{4,6}|
2(?:0|70)\d{5,6}|
(?:4\d|9[2-8])\d{4,7}
</nationalNumberPattern>
<possibleNumberPattern>\d{3,10}</possibleNumberPattern> <possibleNumberPattern>\d{3,10}</possibleNumberPattern>
<exampleNumber>1312345</exampleNumber> <exampleNumber>1312345</exampleNumber>
</fixedLine> </fixedLine>
<mobile> <mobile>
<nationalNumberPattern>(?:[19]1|73)\d{3,8}</nationalNumberPattern>
<possibleNumberPattern>\d{3,10}</possibleNumberPattern>
<exampleNumber>11123456</exampleNumber>
<nationalNumberPattern>(?:[19]1|7[13])\d{6,7}</nationalNumberPattern>
<possibleNumberPattern>\d{8,9}</possibleNumberPattern>
<exampleNumber>911234567</exampleNumber>
</mobile> </mobile>
<!-- No tollFree or premiumRate information can be found.--> <!-- No tollFree or premiumRate information can be found.-->
<voip>
<nationalNumberPattern>86(?:1[12]|22|30|44|8[367]|99)\d{6}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
<exampleNumber>8686123456</exampleNumber>
</voip>
</territory> </territory>
</territories> </territories>
</phoneNumberMetadata> </phoneNumberMetadata>

+ 0
- 1
java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml View File

@ -29,7 +29,6 @@
<!-- Angola --> <!-- Angola -->
<!-- This country has been coopted to test the case of a national prefix <!-- This country has been coopted to test the case of a national prefix
with a non-numeric symbol in it. --> with a non-numeric symbol in it. -->
<territory id="AO" countryCode="244" internationalPrefix="00" nationalPrefix="0~0"> <territory id="AO" countryCode="244" internationalPrefix="00" nationalPrefix="0~0">
<availableFormats> <availableFormats>
<numberFormat pattern="(\d{3})(\d{3})(\d{3})"> <numberFormat pattern="(\d{3})(\d{3})(\d{3})">


+ 15
- 17
java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -198,6 +198,7 @@ public class PhoneNumberUtil {
Arrays.toString(ALPHA_MAPPINGS.keySet().toArray()).replaceAll(", ", "") + Arrays.toString(ALPHA_MAPPINGS.keySet().toArray()).replaceAll(", ", "") +
Arrays.toString(ALPHA_MAPPINGS.keySet().toArray()).toLowerCase().replaceAll(", ", ""); Arrays.toString(ALPHA_MAPPINGS.keySet().toArray()).toLowerCase().replaceAll(", ", "");
private static final String PLUS_CHARS = "+\uFF0B"; private static final String PLUS_CHARS = "+\uFF0B";
private static final Pattern PLUS_CHARS_PATTERN = Pattern.compile("[" + PLUS_CHARS + "]+");
private static final Pattern CAPTURING_DIGIT_PATTERN = private static final Pattern CAPTURING_DIGIT_PATTERN =
Pattern.compile("([" + VALID_DIGITS + "])"); Pattern.compile("([" + VALID_DIGITS + "])");
@ -232,11 +233,12 @@ public class PhoneNumberUtil {
// least three leading digits, and only valid punctuation, alpha characters and // least three leading digits, and only valid punctuation, alpha characters and
// digits in the phone number. Does not include extension data. // digits in the phone number. Does not include extension data.
// The symbol 'x' is allowed here as valid punctuation since it is often used as a placeholder for // The symbol 'x' is allowed here as valid punctuation since it is often used as a placeholder for
// carrier codes, for example in Brazilian phone numbers.
// carrier codes, for example in Brazilian phone numbers. We also allow multiple "+" characters at
// the start.
// Corresponds to the following: // Corresponds to the following:
// plus_sign?([punctuation]*[digits]){3,}([punctuation]|[digits]|[alpha])*
// plus_sign*([punctuation]*[digits]){3,}([punctuation]|[digits]|[alpha])*
private static final String VALID_PHONE_NUMBER = private static final String VALID_PHONE_NUMBER =
"[" + PLUS_CHARS + "]?(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){3,}[" +
"[" + PLUS_CHARS + "]*(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){3,}[" +
VALID_ALPHA + VALID_PUNCTUATION + VALID_DIGITS + "]*"; VALID_ALPHA + VALID_PUNCTUATION + VALID_DIGITS + "]*";
// Default extension prefix to use when formatting. This will be put in front of any extension // Default extension prefix to use when formatting. This will be put in front of any extension
@ -1442,17 +1444,11 @@ public class PhoneNumberUtil {
} }
/** /**
* Gets an AsYouTypeFormatter for the specific country. Note this function doesn't attempt to
* figure out the types of phone number being entered on the fly due to performance reasons.
* Instead, it tries to apply a standard format to all types of phone numbers. For countries
* where different types of phone numbers follow different formats, the formatter returned
* will do no formatting but output exactly what is fed into the inputDigit method.
* Gets an AsYouTypeFormatter for the specific country.
* *
* If the type of the phone number being entered is known beforehand, use
* getAsYouTypeFormatterByType instead.
* @param regionCode the ISO 3166-1 two-letter country code that denotes the
* country/region where the phone number is being entered
* *
* @param regionCode the ISO 3166-1 two-letter country code that denotes
* the country/region where the phone number is being entered
* @return an AsYouTypeFormatter object, which could be used to format phone numbers in the * @return an AsYouTypeFormatter object, which could be used to format phone numbers in the
* specific country "as you type" * specific country "as you type"
*/ */
@ -1622,8 +1618,10 @@ public class PhoneNumberUtil {
if (number.length() == 0) { if (number.length() == 0) {
return CountryCodeSource.FROM_DEFAULT_COUNTRY; return CountryCodeSource.FROM_DEFAULT_COUNTRY;
} }
if (number.charAt(0) == PLUS_SIGN) {
number.deleteCharAt(0);
// Check to see if the number begins with one or more plus signs.
Matcher m = PLUS_CHARS_PATTERN.matcher(number);
if (m.lookingAt()) {
number.delete(0, m.end());
// Can now normalize the rest of the number since we've consumed the "+" sign at the start. // Can now normalize the rest of the number since we've consumed the "+" sign at the start.
normalize(number); normalize(number);
return CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN; return CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN;
@ -1747,7 +1745,7 @@ public class PhoneNumberUtil {
public void parse(String numberToParse, String defaultCountry, PhoneNumber phoneNumber) public void parse(String numberToParse, String defaultCountry, PhoneNumber phoneNumber)
throws NumberParseException { throws NumberParseException {
if (!isValidRegionCode(defaultCountry)) { if (!isValidRegionCode(defaultCountry)) {
if (numberToParse.charAt(0) != PLUS_SIGN) {
if (numberToParse.length() > 0 && numberToParse.charAt(0) != PLUS_SIGN) {
throw new NumberParseException(NumberParseException.ErrorType.INVALID_COUNTRY_CODE, throw new NumberParseException(NumberParseException.ErrorType.INVALID_COUNTRY_CODE,
"Missing or invalid default country."); "Missing or invalid default country.");
} }
@ -1784,7 +1782,7 @@ public class PhoneNumberUtil {
PhoneNumber phoneNumber) PhoneNumber phoneNumber)
throws NumberParseException { throws NumberParseException {
if (!isValidRegionCode(defaultCountry)) { if (!isValidRegionCode(defaultCountry)) {
if (numberToParse.charAt(0) != PLUS_SIGN) {
if (numberToParse.length() > 0 && numberToParse.charAt(0) != PLUS_SIGN) {
throw new NumberParseException(NumberParseException.ErrorType.INVALID_COUNTRY_CODE, throw new NumberParseException(NumberParseException.ErrorType.INVALID_COUNTRY_CODE,
"Missing or invalid default country."); "Missing or invalid default country.");
} }
@ -1798,7 +1796,7 @@ public class PhoneNumberUtil {
* isNumberMatch(). * isNumberMatch().
*/ */
private void parseHelper(String numberToParse, String defaultCountry, private void parseHelper(String numberToParse, String defaultCountry,
Boolean keepRawInput, PhoneNumber phoneNumber)
boolean keepRawInput, PhoneNumber phoneNumber)
throws NumberParseException { throws NumberParseException {
// Extract a possible number from the string passed in (this strips leading characters that // Extract a possible number from the string passed in (this strips leading characters that
// could not be the start of a phone number.) // could not be the start of a phone number.)


+ 17
- 0
java/src/com/google/i18n/phonenumbers/Phonenumber.java View File

@ -178,5 +178,22 @@ public final class Phonenumber {
extension_.equals(other.extension_) && italianLeadingZero_ == other.italianLeadingZero_ && extension_.equals(other.extension_) && italianLeadingZero_ == other.italianLeadingZero_ &&
rawInput_.equals(other.rawInput_) && countryCodeSource_ == other.countryCodeSource_); rawInput_.equals(other.rawInput_) && countryCodeSource_ == other.countryCodeSource_);
} }
@Override
public String toString() {
StringBuffer outputString = new StringBuffer();
outputString.append("Country Code: ").append(countryCode_);
outputString.append(" National Number: ").append(nationalNumber_);
if (hasItalianLeadingZero() && getItalianLeadingZero()) {
outputString.append(" Leading Zero: true");
}
if (hasExtension()) {
outputString.append(" Extension: ").append(extension_);
}
if (hasCountryCodeSource()) {
outputString.append(" Country Code Source: ").append(countryCodeSource_);
}
return outputString.toString();
}
} }
} }

BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BO View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GG View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GN View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IM View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JE View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KR View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PT View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RU View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TT View File


BIN
java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZW View File


+ 89
- 169
java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java View File

@ -20,6 +20,7 @@ import com.google.i18n.phonenumbers.Phonemetadata.NumberFormat;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata; import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber; import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource; import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -237,194 +238,122 @@ public class PhoneNumberUtilTest extends TestCase {
public void testFormatUSNumber() { public void testFormatUSNumber() {
PhoneNumber usNumber = new PhoneNumber(); PhoneNumber usNumber = new PhoneNumber();
usNumber.setCountryCode(1).setNationalNumber(6502530000L); usNumber.setCountryCode(1).setNationalNumber(6502530000L);
assertEquals("650 253 0000", phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+1 650 253 0000",
phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("650 253 0000", phoneUtil.format(usNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+1 650 253 0000", phoneUtil.format(usNumber, PhoneNumberFormat.INTERNATIONAL));
usNumber.clear(); usNumber.clear();
usNumber.setCountryCode(1).setNationalNumber(8002530000L); usNumber.setCountryCode(1).setNationalNumber(8002530000L);
assertEquals("800 253 0000", phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+1 800 253 0000",
phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("800 253 0000", phoneUtil.format(usNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+1 800 253 0000", phoneUtil.format(usNumber, PhoneNumberFormat.INTERNATIONAL));
usNumber.clear(); usNumber.clear();
usNumber.setCountryCode(1).setNationalNumber(9002530000L); usNumber.setCountryCode(1).setNationalNumber(9002530000L);
assertEquals("900 253 0000", phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+1 900 253 0000",
phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("900 253 0000", phoneUtil.format(usNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+1 900 253 0000", phoneUtil.format(usNumber, PhoneNumberFormat.INTERNATIONAL));
} }
public void testFormatBSNumber() { public void testFormatBSNumber() {
PhoneNumber bsNumber = new PhoneNumber(); PhoneNumber bsNumber = new PhoneNumber();
bsNumber.setCountryCode(1).setNationalNumber(2421234567L); bsNumber.setCountryCode(1).setNationalNumber(2421234567L);
assertEquals("242 123 4567", phoneUtil.format(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+1 242 123 4567",
phoneUtil.format(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("242 123 4567", phoneUtil.format(bsNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+1 242 123 4567", phoneUtil.format(bsNumber, PhoneNumberFormat.INTERNATIONAL));
bsNumber.clear(); bsNumber.clear();
bsNumber.setCountryCode(1).setNationalNumber(8002530000L); bsNumber.setCountryCode(1).setNationalNumber(8002530000L);
assertEquals("800 253 0000", phoneUtil.format(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+1 800 253 0000",
phoneUtil.format(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("800 253 0000", phoneUtil.format(bsNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+1 800 253 0000", phoneUtil.format(bsNumber, PhoneNumberFormat.INTERNATIONAL));
bsNumber.clear(); bsNumber.clear();
bsNumber.setCountryCode(1).setNationalNumber(9002530000L); bsNumber.setCountryCode(1).setNationalNumber(9002530000L);
assertEquals("900 253 0000", phoneUtil.format(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+1 900 253 0000",
phoneUtil.format(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("900 253 0000", phoneUtil.format(bsNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+1 900 253 0000", phoneUtil.format(bsNumber, PhoneNumberFormat.INTERNATIONAL));
} }
public void testFormatGBNumber() { public void testFormatGBNumber() {
PhoneNumber gbNumber = new PhoneNumber(); PhoneNumber gbNumber = new PhoneNumber();
gbNumber.setCountryCode(44).setNationalNumber(2087389353L); gbNumber.setCountryCode(44).setNationalNumber(2087389353L);
assertEquals("(020) 8738 9353", phoneUtil.format(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+44 20 8738 9353",
phoneUtil.format(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("(020) 8738 9353", phoneUtil.format(gbNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+44 20 8738 9353", phoneUtil.format(gbNumber, PhoneNumberFormat.INTERNATIONAL));
gbNumber.clear(); gbNumber.clear();
gbNumber.setCountryCode(44).setNationalNumber(7912345678L); gbNumber.setCountryCode(44).setNationalNumber(7912345678L);
assertEquals("(07912) 345 678", phoneUtil.format(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+44 7912 345 678",
phoneUtil.format(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("(07912) 345 678", phoneUtil.format(gbNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+44 7912 345 678", phoneUtil.format(gbNumber, PhoneNumberFormat.INTERNATIONAL));
} }
public void testFormatDENumber() { public void testFormatDENumber() {
PhoneNumber deNumber = new PhoneNumber(); PhoneNumber deNumber = new PhoneNumber();
deNumber.setCountryCode(49).setNationalNumber(301234L); deNumber.setCountryCode(49).setNationalNumber(301234L);
assertEquals("030 1234", phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+49 30 1234",
phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("030 1234", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+49 30 1234", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL));
deNumber.clear(); deNumber.clear();
deNumber.setCountryCode(49).setNationalNumber(291123L); deNumber.setCountryCode(49).setNationalNumber(291123L);
assertEquals("0291 123", phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+49 291 123",
phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("0291 123", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+49 291 123", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL));
deNumber.clear(); deNumber.clear();
deNumber.setCountryCode(49).setNationalNumber(29112345678L); deNumber.setCountryCode(49).setNationalNumber(29112345678L);
assertEquals("0291 12345678", phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+49 291 12345678",
phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("0291 12345678", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+49 291 12345678", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL));
deNumber.clear(); deNumber.clear();
deNumber.setCountryCode(49).setNationalNumber(9123123L); deNumber.setCountryCode(49).setNationalNumber(9123123L);
assertEquals("09123 123", phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+49 9123 123",
phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("09123 123", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+49 9123 123", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL));
deNumber.clear(); deNumber.clear();
deNumber.setCountryCode(49).setNationalNumber(80212345L); deNumber.setCountryCode(49).setNationalNumber(80212345L);
assertEquals("08021 2345", phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+49 8021 2345",
phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("08021 2345", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+49 8021 2345", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL));
deNumber.clear(); deNumber.clear();
deNumber.setCountryCode(49).setNationalNumber(1234L); deNumber.setCountryCode(49).setNationalNumber(1234L);
// Note this number is correctly formatted without national prefix. Most of the numbers that // Note this number is correctly formatted without national prefix. Most of the numbers that
// are treated as invalid numbers by the library are short numbers, and they are usually not // are treated as invalid numbers by the library are short numbers, and they are usually not
// dialed with national prefix. // dialed with national prefix.
assertEquals("1234", phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+49 1234",
phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("1234", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+49 1234", phoneUtil.format(deNumber, PhoneNumberFormat.INTERNATIONAL));
} }
public void testFormatITNumber() { public void testFormatITNumber() {
PhoneNumber itNumber = new PhoneNumber(); PhoneNumber itNumber = new PhoneNumber();
itNumber.setCountryCode(39).setNationalNumber(236618300L).setItalianLeadingZero(true); itNumber.setCountryCode(39).setNationalNumber(236618300L).setItalianLeadingZero(true);
assertEquals("02 3661 8300", phoneUtil.format(itNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+39 02 3661 8300",
phoneUtil.format(itNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("+390236618300",
phoneUtil.format(itNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("02 3661 8300", phoneUtil.format(itNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+39 02 3661 8300", phoneUtil.format(itNumber, PhoneNumberFormat.INTERNATIONAL));
assertEquals("+390236618300", phoneUtil.format(itNumber, PhoneNumberFormat.E164));
itNumber.clear(); itNumber.clear();
itNumber.setCountryCode(39).setNationalNumber(345678901L); itNumber.setCountryCode(39).setNationalNumber(345678901L);
assertEquals("345 678 901", phoneUtil.format(itNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+39 345 678 901",
phoneUtil.format(itNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("+39345678901",
phoneUtil.format(itNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("345 678 901", phoneUtil.format(itNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+39 345 678 901", phoneUtil.format(itNumber, PhoneNumberFormat.INTERNATIONAL));
assertEquals("+39345678901", phoneUtil.format(itNumber, PhoneNumberFormat.E164));
} }
public void testFormatAUNumber() { public void testFormatAUNumber() {
PhoneNumber auNumber = new PhoneNumber(); PhoneNumber auNumber = new PhoneNumber();
auNumber.setCountryCode(61).setNationalNumber(236618300L); auNumber.setCountryCode(61).setNationalNumber(236618300L);
assertEquals("02 3661 8300", phoneUtil.format(auNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+61 2 3661 8300",
phoneUtil.format(auNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("+61236618300",
phoneUtil.format(auNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("02 3661 8300", phoneUtil.format(auNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+61 2 3661 8300", phoneUtil.format(auNumber, PhoneNumberFormat.INTERNATIONAL));
assertEquals("+61236618300", phoneUtil.format(auNumber, PhoneNumberFormat.E164));
auNumber.clear(); auNumber.clear();
auNumber.setCountryCode(61).setNationalNumber(1800123456L); auNumber.setCountryCode(61).setNationalNumber(1800123456L);
assertEquals("1800 123 456", phoneUtil.format(auNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+61 1800 123 456",
phoneUtil.format(auNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("+611800123456",
phoneUtil.format(auNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("1800 123 456", phoneUtil.format(auNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+61 1800 123 456", phoneUtil.format(auNumber, PhoneNumberFormat.INTERNATIONAL));
assertEquals("+611800123456", phoneUtil.format(auNumber, PhoneNumberFormat.E164));
} }
public void testFormatARNumber() { public void testFormatARNumber() {
PhoneNumber arNumber = new PhoneNumber(); PhoneNumber arNumber = new PhoneNumber();
arNumber.setCountryCode(54).setNationalNumber(1187654321L); arNumber.setCountryCode(54).setNationalNumber(1187654321L);
assertEquals("011 8765-4321", phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+54 11 8765-4321",
phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("+541187654321",
phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("011 8765-4321", phoneUtil.format(arNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+54 11 8765-4321", phoneUtil.format(arNumber, PhoneNumberFormat.INTERNATIONAL));
assertEquals("+541187654321", phoneUtil.format(arNumber, PhoneNumberFormat.E164));
arNumber.clear(); arNumber.clear();
arNumber.setCountryCode(54).setNationalNumber(91187654321L); arNumber.setCountryCode(54).setNationalNumber(91187654321L);
assertEquals("011 15 8765-4321", phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+54 9 11 8765 4321",
phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("+5491187654321",
phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("011 15 8765-4321", phoneUtil.format(arNumber, PhoneNumberFormat.NATIONAL));
assertEquals("+54 9 11 8765 4321", phoneUtil.format(arNumber, PhoneNumberFormat.INTERNATIONAL));
assertEquals("+5491187654321", phoneUtil.format(arNumber, PhoneNumberFormat.E164));
} }
public void testFormatOutOfCountryCallingNumber() { public void testFormatOutOfCountryCallingNumber() {
@ -499,18 +428,15 @@ public class PhoneNumberUtilTest extends TestCase {
// We only support this for AR in our test metadata. // We only support this for AR in our test metadata.
PhoneNumber arNumber = new PhoneNumber(); PhoneNumber arNumber = new PhoneNumber();
arNumber.setCountryCode(54).setNationalNumber(91234125678L); arNumber.setCountryCode(54).setNationalNumber(91234125678L);
assertEquals("01234 12-5678", phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("01234 12-5678", phoneUtil.format(arNumber, PhoneNumberFormat.NATIONAL));
// Test formatting with a carrier code. // Test formatting with a carrier code.
assertEquals("01234 15 12-5678", phoneUtil.formatNationalNumberWithCarrierCode(arNumber, "15")); assertEquals("01234 15 12-5678", phoneUtil.formatNationalNumberWithCarrierCode(arNumber, "15"));
// Here the international rule is used, so no carrier code should be present. // Here the international rule is used, so no carrier code should be present.
assertEquals("+5491234125678", phoneUtil.format(arNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("+5491234125678", phoneUtil.format(arNumber, PhoneNumberFormat.E164));
// We don't support this for the US so there should be no change. // We don't support this for the US so there should be no change.
PhoneNumber usNumber = new PhoneNumber(); PhoneNumber usNumber = new PhoneNumber();
usNumber.setCountryCode(1).setNationalNumber(4241231234L); usNumber.setCountryCode(1).setNationalNumber(4241231234L);
assertEquals("424 123 1234", phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("424 123 1234", phoneUtil.format(usNumber, PhoneNumberFormat.NATIONAL));
assertEquals("424 123 1234", phoneUtil.formatNationalNumberWithCarrierCode(usNumber, "15")); assertEquals("424 123 1234", phoneUtil.formatNationalNumberWithCarrierCode(usNumber, "15"));
} }
@ -524,14 +450,11 @@ public class PhoneNumberUtilTest extends TestCase {
List<NumberFormat> newNumberFormats = new ArrayList<NumberFormat>(); List<NumberFormat> newNumberFormats = new ArrayList<NumberFormat>();
newNumberFormats.add(newNumFormat); newNumberFormats.add(newNumFormat);
assertEquals("(650) 253-0000",
phoneUtil.formatByPattern(usNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
newNumberFormats));
assertEquals("+1 (650) 253-0000",
phoneUtil.formatByPattern(usNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL,
newNumberFormats));
assertEquals("(650) 253-0000", phoneUtil.formatByPattern(usNumber, PhoneNumberFormat.NATIONAL,
newNumberFormats));
assertEquals("+1 (650) 253-0000", phoneUtil.formatByPattern(usNumber,
PhoneNumberFormat.INTERNATIONAL,
newNumberFormats));
// $NP is set to '1' for the US. Here we check that for other NANPA countries the US rules are // $NP is set to '1' for the US. Here we check that for other NANPA countries the US rules are
// followed. // followed.
@ -540,12 +463,9 @@ public class PhoneNumberUtilTest extends TestCase {
PhoneNumber bsNumber = new PhoneNumber(); PhoneNumber bsNumber = new PhoneNumber();
bsNumber.setCountryCode(1).setNationalNumber(4168819999L); bsNumber.setCountryCode(1).setNationalNumber(4168819999L);
assertEquals("1 (416) 881-9999", assertEquals("1 (416) 881-9999",
phoneUtil.formatByPattern(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
newNumberFormats));
phoneUtil.formatByPattern(bsNumber, PhoneNumberFormat.NATIONAL, newNumberFormats));
assertEquals("+1 416 881-9999", assertEquals("+1 416 881-9999",
phoneUtil.formatByPattern(bsNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL,
phoneUtil.formatByPattern(bsNumber, PhoneNumberFormat.INTERNATIONAL,
newNumberFormats)); newNumberFormats));
PhoneNumber itNumber = new PhoneNumber(); PhoneNumber itNumber = new PhoneNumber();
@ -556,12 +476,9 @@ public class PhoneNumberUtilTest extends TestCase {
newNumberFormats.set(0, newNumFormat); newNumberFormats.set(0, newNumFormat);
assertEquals("02-36618 300", assertEquals("02-36618 300",
phoneUtil.formatByPattern(itNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
newNumberFormats));
phoneUtil.formatByPattern(itNumber, PhoneNumberFormat.NATIONAL, newNumberFormats));
assertEquals("+39 02-36618 300", assertEquals("+39 02-36618 300",
phoneUtil.formatByPattern(itNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL,
phoneUtil.formatByPattern(itNumber, PhoneNumberFormat.INTERNATIONAL,
newNumberFormats)); newNumberFormats));
PhoneNumber gbNumber = new PhoneNumber(); PhoneNumber gbNumber = new PhoneNumber();
@ -572,53 +489,40 @@ public class PhoneNumberUtilTest extends TestCase {
newNumFormat.setFormat("$1 $2 $3"); newNumFormat.setFormat("$1 $2 $3");
newNumberFormats.set(0, newNumFormat); newNumberFormats.set(0, newNumFormat);
assertEquals("020 1234 5678", assertEquals("020 1234 5678",
phoneUtil.formatByPattern(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
newNumberFormats));
phoneUtil.formatByPattern(gbNumber, PhoneNumberFormat.NATIONAL, newNumberFormats));
newNumFormat.setNationalPrefixFormattingRule("($NP$FG)"); newNumFormat.setNationalPrefixFormattingRule("($NP$FG)");
assertEquals("(020) 1234 5678", assertEquals("(020) 1234 5678",
phoneUtil.formatByPattern(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
newNumberFormats));
phoneUtil.formatByPattern(gbNumber, PhoneNumberFormat.NATIONAL, newNumberFormats));
newNumFormat.setNationalPrefixFormattingRule(""); newNumFormat.setNationalPrefixFormattingRule("");
assertEquals("20 1234 5678", assertEquals("20 1234 5678",
phoneUtil.formatByPattern(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
newNumberFormats));
phoneUtil.formatByPattern(gbNumber, PhoneNumberFormat.NATIONAL, newNumberFormats));
newNumFormat.setNationalPrefixFormattingRule(""); newNumFormat.setNationalPrefixFormattingRule("");
assertEquals("+44 20 1234 5678", assertEquals("+44 20 1234 5678",
phoneUtil.formatByPattern(gbNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL,
phoneUtil.formatByPattern(gbNumber, PhoneNumberFormat.INTERNATIONAL,
newNumberFormats)); newNumberFormats));
} }
public void testFormatE164Number() { public void testFormatE164Number() {
PhoneNumber usNumber = new PhoneNumber(); PhoneNumber usNumber = new PhoneNumber();
usNumber.setCountryCode(1).setNationalNumber(6502530000L); usNumber.setCountryCode(1).setNationalNumber(6502530000L);
assertEquals("+16502530000", phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("+16502530000", phoneUtil.format(usNumber, PhoneNumberFormat.E164));
PhoneNumber deNumber = new PhoneNumber(); PhoneNumber deNumber = new PhoneNumber();
deNumber.setCountryCode(49).setNationalNumber(301234L); deNumber.setCountryCode(49).setNationalNumber(301234L);
assertEquals("+49301234", phoneUtil.format(deNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("+49301234", phoneUtil.format(deNumber, PhoneNumberFormat.E164));
} }
public void testFormatNumberWithExtension() { public void testFormatNumberWithExtension() {
PhoneNumber nzNumber = new PhoneNumber(); PhoneNumber nzNumber = new PhoneNumber();
nzNumber.setCountryCode(64).setNationalNumber(33316005L).setExtension("1234"); nzNumber.setCountryCode(64).setNationalNumber(33316005L).setExtension("1234");
// Uses default extension prefix: // Uses default extension prefix:
assertEquals("03-331 6005 ext. 1234",
phoneUtil.format(nzNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("03-331 6005 ext. 1234", phoneUtil.format(nzNumber, PhoneNumberFormat.NATIONAL));
// Extension prefix overridden in the territory information for the US: // Extension prefix overridden in the territory information for the US:
PhoneNumber usNumber = new PhoneNumber(); PhoneNumber usNumber = new PhoneNumber();
usNumber.setCountryCode(1).setNationalNumber(6502530000L).setExtension("4567"); usNumber.setCountryCode(1).setNationalNumber(6502530000L).setExtension("4567");
assertEquals("650 253 0000 extn. 4567",
phoneUtil.format(usNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("650 253 0000 extn. 4567", phoneUtil.format(usNumber, PhoneNumberFormat.NATIONAL));
} }
public void testFormatUsingOriginalNumberFormat() throws Exception { public void testFormatUsingOriginalNumberFormat() throws Exception {
@ -1361,6 +1265,14 @@ public class PhoneNumberUtilTest extends TestCase {
assertEquals(usNumber, phoneUtil.parse("0191-650-333-6000", "SG")); assertEquals(usNumber, phoneUtil.parse("0191-650-333-6000", "SG"));
// Calling the US number from Poland // Calling the US number from Poland
assertEquals(usNumber, phoneUtil.parse("0~01-650-333-6000", "PL")); assertEquals(usNumber, phoneUtil.parse("0~01-650-333-6000", "PL"));
// Using "++" at the start.
assertEquals(usNumber, phoneUtil.parse("++1 (650) 333-6000", "PL"));
// Using a full-width plus sign.
assertEquals(usNumber, phoneUtil.parse("\uFF0B1 (650) 333-6000", "SG"));
// The whole number, including punctuation, is here represented in full-width form.
assertEquals(usNumber, phoneUtil.parse("\uFF0B\uFF11\u3000\uFF08\uFF16\uFF15\uFF10\uFF09" +
"\u3000\uFF13\uFF13\uFF13\uFF0D\uFF16\uFF10\uFF10\uFF10",
"SG"));
} }
public void testParseWithLeadingZero() throws Exception { public void testParseWithLeadingZero() throws Exception {
@ -1558,6 +1470,17 @@ public class PhoneNumberUtilTest extends TestCase {
NumberParseException.ErrorType.TOO_SHORT_AFTER_IDD, NumberParseException.ErrorType.TOO_SHORT_AFTER_IDD,
e.getErrorType()); e.getErrorType());
} }
try {
String emptyNumber = "";
// Invalid region.
phoneUtil.parse(emptyNumber, "ZZ");
fail("Empty string - should fail.");
} catch (NumberParseException e) {
// Expected this exception.
assertEquals("Wrong error type stored in exception.",
NumberParseException.ErrorType.NOT_A_NUMBER,
e.getErrorType());
}
} }
public void testParseNumbersWithPlusWithNoRegion() throws Exception { public void testParseNumbersWithPlusWithNoRegion() throws Exception {
@ -1675,12 +1598,9 @@ public class PhoneNumberUtilTest extends TestCase {
// Andorra is a country where we don't have PhoneNumberDesc info in the metadata. // Andorra is a country where we don't have PhoneNumberDesc info in the metadata.
PhoneNumber adNumber = new PhoneNumber(); PhoneNumber adNumber = new PhoneNumber();
adNumber.setCountryCode(376).setNationalNumber(12345L); adNumber.setCountryCode(376).setNationalNumber(12345L);
assertEquals("+376 12345", phoneUtil.format(adNumber,
PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
assertEquals("+37612345", phoneUtil.format(adNumber,
PhoneNumberUtil.PhoneNumberFormat.E164));
assertEquals("12345", phoneUtil.format(adNumber,
PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
assertEquals("+376 12345", phoneUtil.format(adNumber, PhoneNumberFormat.INTERNATIONAL));
assertEquals("+37612345", phoneUtil.format(adNumber, PhoneNumberFormat.E164));
assertEquals("12345", phoneUtil.format(adNumber, PhoneNumberFormat.NATIONAL));
assertEquals(PhoneNumberUtil.PhoneNumberType.UNKNOWN, phoneUtil.getNumberType(adNumber)); assertEquals(PhoneNumberUtil.PhoneNumberType.UNKNOWN, phoneUtil.getNumberType(adNumber));
assertTrue(phoneUtil.isValidNumber(adNumber)); assertTrue(phoneUtil.isValidNumber(adNumber));


Loading…
Cancel
Save