diff --git a/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml b/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml
index d714e48a8..a463f4952 100644
--- a/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml
+++ b/java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml
@@ -892,7 +892,8 @@
-
@@ -936,7 +937,7 @@
-
+
@@ -944,16 +945,17 @@
\d{7,10}
- 242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3-57]|9[2-5])|4(?:2[237]|51|64|77)|502|636|702)\d{4}
+ 242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3467]|8[0-4]|9[2-467])|461|502|6(?:12|7[67]|8[78]|9[89])|702)\d{4}
2423456789
- 242(?:[3-5]57|359)\d{4}
+ 242(?:3(?:5[79]|[79]5)|4(?:[2-4][1-9]|5[1-8]|6[2-8]|7\d|81)|5(?:2[34]|3[35]|44|5[1-9]|65|77)|6[34]6|727)\d{4}
\d{10}
2423591234
- 8(?:00|66|77|88)[2-9]\d{6}
+
+ 242300\d{4}|8(?:00|66|77|88)[2-9]\d{6}
\d{10}
8002123456
@@ -1321,7 +1323,9 @@
$1 $2 $3
-
+ $1 $2 $3
$1 $2 $3
$1 $2 $3
- $1 $2 $3
+ $1 $2 $3
[1-79]\d{7,11}|8[0-357-9]\d{6,9}
@@ -1388,7 +1392,7 @@
$1 $2 $3
- [29]\d{6}
+ [259]\d{6}
\d{7}
@@ -1396,10 +1400,10 @@
2211234
-
- 9[157-9]\d{5}
+
+ (?:9\d|59)\d{5}
9911234
@@ -2011,6 +2015,8 @@
+
@@ -2044,13 +2050,15 @@
- 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]|[378]\d|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|2[024-9]|3[014-689]|4[02-9]|[57][03-9]|6\d|8[0-68]|9[0-57-9])|6(?:0[034689]|2[0-689]|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}
+ 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[035689]|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}
1212345678
- 7(?:[1-57-9]\d{8}|624\d{6})
+
+ 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}
\d{10}
- 7123456789
+ 7400123456
+ (?:9[018]\d|87[1-3])\d{7}
\d{10}
9012345678
- 8(?:4[3-5]|7[01])\d{7}
+ 8(?:4[3-5]|70)\d{7}
\d{10}
8431234567
@@ -2138,14 +2148,12 @@
- (?:122|2(?:22|36|5[03])|3(?:1[0-35-8]|[256]\d|3[1-35679]|4[024-79]|7[0-39]|9[1-35-7])|44[2-6])\d{5}
+ (?:122|2(?:22|36|5[03])|3(?:1[0-35-8]|[24-6]\d|3[1-35679]|7[0-39]|9[1-35-7])|44[2-6])\d{5}
\d{3,8}
32123456
-
- (?:5[014578]|62|7[1479]|9[0135-9])\d{6}
+ (?:5[1578]|6[28]|7[0147-9]|9[0135-9])\d{6}
\d{8}
55123456
@@ -2161,6 +2169,53 @@
+
+
+
+
+
+ [157-9]\d{6,9}
+ \d{6,10}
+
+
+ 1481\d{6}
+ 1481123456
+
+
+ 7(?:781|839|911)\d{6}
+ \d{10}
+ 7781123456
+
+
+
+ 80(?:01111|\d{7,8})|500\d{6}
+ \d{7,10}
+ 8012345678
+
+
+ (?:9[018]\d|87[1-3])\d{7}
+ \d{10}
+ 9012345678
+
+
+ 8(?:4[3-5]|70)\d{7}
+ \d{10}
+ 8431234567
+
+
+ 70\d{8}
+ \d{10}
+ 7012345678
+
+
+ 56\d{8}
+ \d{10}
+ 5612345678
+
+
+
@@ -2712,6 +2767,52 @@
+
+
+
+
+
+ [157-9]\d{6,9}
+ \d{6,10}
+
+
+ 1624\d{6}
+ 1624123456
+
+
+ 7[69]24\d{6}
+ 7624123456
+
+
+
+ 80(?:01111|\d{7,8})|500\d{6}
+ \d{7,10}
+ 8012345678
+
+
+ (?:9[018]\d|87[1-3])\d{7}
+ \d{10}
+ 9012345678
+
+
+ 8(?:4[3-5]|70)\d{7}
+ \d{10}
+ 8431234567
+
+
+ 70\d{8}
+ \d{10}
+ 7012345678
+
+
+ 56\d{8}
+ \d{10}
+ 5612345678
+
+
+
@@ -2930,6 +3031,53 @@
+
+
+
+
+
+ [157-9]\d{6,9}
+ \d{6,10}
+
+
+ 1534\d{6}
+ 1534123456
+
+
+ 7(?:7(?:00|97)|829|937)\d{6}
+ \d{10}
+ 7797123456
+
+
+
+ 80(?:01111|\d{7,8})|500\d{6}
+ \d{7,10}
+ 8012345678
+
+
+ (?:9[018]\d|87[1-3])\d{7}
+ \d{10}
+ 9012345678
+
+
+ 8(?:4[3-5]|70)\d{7}
+ \d{10}
+ 8431234567
+
+
+ 70\d{8}
+ \d{10}
+ 7012345678
+
+
+ 56\d{8}
+ \d{10}
+ 5612345678
+
+
+
@@ -4451,7 +4599,8 @@
-
+
$1 $2 $3 $4
- [2-9]\d{7}
- \d{8}
+ 0\d{4}|[2-9]\d{7}
+ \d{5}(?:\d{3})?
- (?:2[1-4]|3[1-3578]|5[1-35-7]|6[1-4679]|7\d)\d{6}|81(?:0(?:0[7-9]|1\d)|5\d{2})\d{3}
+ numbers, as well as the 5-digit country-wide numbers used by businesses
+ that begin with 0. -->
+ 0\d{4}|(?:2[1-4]|3[1-3578]|5[1-35-7]|6[1-4679]|7\d)\d{6}|81(?:0(?:0[7-9]|1\d)|5\d{2})\d{3}
21234567
(?:4[015-8]|9\d)\d{6}
+ \d{8}
41234567
80[01]\d{5}
+ \d{8}
80012345
82[09]\d{5}
+ \d{8}
82012345
810(?:0[0-6]|[2-8]\d)\d{3}
+ \d{8}
81021234
880\d{5}
+ \d{8}
88012345
@@ -4963,8 +5118,10 @@
+
+ nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG"
+ preferredExtnPrefix=" int ">
$1 $2 $3
@@ -4973,15 +5130,18 @@
[237-9]\d{8}
- \d{6,9}
+
+ \d{9}
- [23][3-6]\d{7}
- 231234567
+ [23][13-6]\d{7}
+ 211234567
- 7\d{8}
- \d{9}
+ 7[1-8]\d{7}
712345678
@@ -4990,10 +5150,17 @@
800123456
- 9\d{8}
- \d{9}
- 912345678
+ 90[036]\d{6}
+ 900123456
+
+ 801\d{6}
+ 801123456
+
+
+ 802\d{6}
+ 802123456
+
@@ -6060,6 +6227,31 @@
+
+
+
+
+
+ $1 $2 $3
+
+
+ 06\d{8}
+ \d{10}
+
+
+ 06698\d{5}
+ 0669812345
+
+
+
+ N/A
+ N/A
+
+
+
+
diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberMetadataProto b/java/src/com/google/i18n/phonenumbers/PhoneNumberMetadataProto
index 251b52752..13a506d20 100644
Binary files a/java/src/com/google/i18n/phonenumbers/PhoneNumberMetadataProto and b/java/src/com/google/i18n/phonenumbers/PhoneNumberMetadataProto differ
diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
index ce0ab66c9..c027a92d4 100644
--- a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
+++ b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
@@ -68,9 +68,13 @@ public class PhoneNumberUtil {
private static final int NANPA_COUNTRY_CODE = 1;
// The set of countries that share country code 7.
- private final HashSet russiaFederationCountries = new HashSet(2);
+ private final HashSet russiaFederationCountries = new HashSet(3);
private static final int RUSSIAN_FED_COUNTRY_CODE = 7;
+ // The set of countries that share country code 44.
+ private final HashSet greatBritainAndDependencies = new HashSet(7);
+ private static final int GREAT_BRITAIN_COUNTRY_CODE = 44;
+
// The set of countries that share country code 262.
private final HashSet frenchIndianOceanTerritories = new HashSet(6);
@@ -165,11 +169,13 @@ public class PhoneNumberUtil {
static {
HashSet aSet = new HashSet(10);
aSet.add(39); // Italy
+ aSet.add(47); // Norway
aSet.add(225); // Cote d'Ivoire
aSet.add(227); // Niger
aSet.add(228); // Togo
aSet.add(240); // Equatorial Guinea
aSet.add(241); // Gabon
+ aSet.add(379); // Vatican City
LEADING_ZERO_COUNTRIES = Collections.unmodifiableSet(aSet);
}
@@ -377,17 +383,21 @@ public class PhoneNumberUtil {
frenchIndianOceanTerritories.add(regionCode);
frenchIndianOceanTerritories.add(regionCode.toLowerCase());
break;
+ case GREAT_BRITAIN_COUNTRY_CODE:
+ greatBritainAndDependencies.add(regionCode);
+ break;
default:
countryCodeToRegionCodeMap.put(countryCode, regionCode);
break;
}
}
- // Override the value, so that 1 is always mapped to US, 7 is always mapped to RU, and 262 to
- // RE.
+ // Override the value, so that 1 is always mapped to US, 7 is always mapped to RU, 44 to GB
+ // and 262 to RE.
countryCodeToRegionCodeMap.put(NANPA_COUNTRY_CODE, "US");
countryCodeToRegionCodeMap.put(RUSSIAN_FED_COUNTRY_CODE, "RU");
countryCodeToRegionCodeMap.put(FRENCH_INDIAN_OCEAN_COUNTRY_CODE, "RE");
+ countryCodeToRegionCodeMap.put(GREAT_BRITAIN_COUNTRY_CODE, "GB");
} catch (IOException e) {
LOGGER.log(Level.WARNING, e.toString());
} catch (ClassNotFoundException e) {
@@ -799,6 +809,12 @@ public Set getSupportedCountries() {
// Details here: http://www.petitfute.com/voyage/225-info-pratiques-reunion
return format(number, PhoneNumberFormat.NATIONAL);
}
+ if (countryCode == GREAT_BRITAIN_COUNTRY_CODE &&
+ greatBritainAndDependencies.contains(countryCallingFrom)) {
+ // It seems that numbers can be dialled in national format between Great Britain and the crown
+ // dependencies with the same country code.
+ return format(number, PhoneNumberFormat.NATIONAL);
+ }
// If the country code is the Russian Fed country code, we check the number itself to determine
// which region code it is for. We don't do this for NANPA countries because of performance
// reasons, and instead use US rules for all NANPA numbers. Also, NANPA countries share the
@@ -1178,8 +1194,7 @@ public Set getSupportedCountries() {
int numberLength = nationalSignificantNumber.length();
return numberLength > MIN_LENGTH_FOR_NSN && numberLength <= MAX_LENGTH_FOR_NSN;
}
- return isNumberMatchingDesc(nationalSignificantNumber, generalNumDesc)
- && getNumberTypeHelper(nationalSignificantNumber, metadata) != PhoneNumberType.UNKNOWN;
+ return getNumberTypeHelper(nationalSignificantNumber, metadata) != PhoneNumberType.UNKNOWN;
}
/**
@@ -1207,6 +1222,8 @@ public Set getSupportedCountries() {
return getRegionCodeForNumberFromRegionList(number, russiaFederationCountries);
case FRENCH_INDIAN_OCEAN_COUNTRY_CODE:
return getRegionCodeForNumberFromRegionList(number, frenchIndianOceanTerritories);
+ case GREAT_BRITAIN_COUNTRY_CODE:
+ return getRegionCodeForNumberFromRegionList(number, greatBritainAndDependencies);
default:
return getRegionCodeForCountryCode(countryCode);
}