diff --git a/java/release_notes.txt b/java/release_notes.txt index c6a9d97eb..59f43ef3e 100644 --- a/java/release_notes.txt +++ b/java/release_notes.txt @@ -1,3 +1,13 @@ +May 9th, 2011 +* Code changes: + - Fixed potential for a null-ptr exception in getExampleNumber + - Potential speed improvement with replacement of StringBuffer with StringBuilder +* Metadata changes + - Changed way that international formats are specified to make it easier to do so + - New countries: AX, CC, CX, WF + - Updates: AM, AR, AU, AW, CN, CO, CR, DM, EC, ET, FI, FJ, GH, IN, JP, KE, KM, + KN, LR, MD, MQ, MX, NP, PH, SC, SE, SM, SN, SY, UG, US, VC, VI, ZM + Apr 26th, 2011 * Code changes: - Improved PhoneNumberMatcher for cases with other numbers before or after the phone number. diff --git a/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java b/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java index 7f552d922..a73ffeed9 100644 --- a/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java +++ b/java/resources/com/google/i18n/phonenumbers/BuildMetadataFromXml.java @@ -80,7 +80,7 @@ public class BuildMetadataFromXml { String regionCode = metadata.getId(); int countryCode = metadata.getCountryCode(); if (countryCodeToRegionCodeMap.containsKey(countryCode)) { - if (metadata.getMainCountryForCode()) { + if (metadata.isMainCountryForCode()) { countryCodeToRegionCodeMap.get(countryCode).add(0, regionCode); } else { countryCodeToRegionCodeMap.get(countryCode).add(regionCode); @@ -160,11 +160,14 @@ public class BuildMetadataFromXml { // Extract availableFormats NodeList numberFormatElements = element.getElementsByTagName("numberFormat"); + boolean hasExplicitIntlFormatDefined = false; + int numOfFormatElements = numberFormatElements.getLength(); if (numOfFormatElements > 0) { for (int i = 0; i < numOfFormatElements; i++) { Element numberFormatElement = (Element) numberFormatElements.item(i); NumberFormat format = new NumberFormat(); + if (numberFormatElement.hasAttribute("nationalPrefixFormattingRule")) { format.setNationalPrefixFormattingRule( getNationalPrefixFormattingRuleFromElement(numberFormatElement, nationalPrefix)); @@ -178,8 +181,11 @@ public class BuildMetadataFromXml { } else { format.setDomesticCarrierCodeFormattingRule(carrierCodeFormattingRule); } + + // Extract the pattern for the national format. setLeadingDigitsPatterns(numberFormatElement, format); format.setPattern(validateRE(numberFormatElement.getAttribute("pattern"))); + NodeList formatPattern = numberFormatElement.getElementsByTagName("format"); if (formatPattern.getLength() != 1) { LOGGER.log(Level.SEVERE, @@ -187,35 +193,46 @@ public class BuildMetadataFromXml { throw new RuntimeException("Invalid number of format patterns for country: " + regionCode); } - format.setFormat(formatPattern.item(0).getFirstChild().getNodeValue()); + String nationalFormat = formatPattern.item(0).getFirstChild().getNodeValue(); + format.setFormat(nationalFormat); metadata.addNumberFormat(format); - } - } - NodeList intlNumberFormatElements = element.getElementsByTagName("intlNumberFormat"); - int numOfIntlFormatElements = intlNumberFormatElements.getLength(); - if (numOfIntlFormatElements > 0) { - for (int i = 0; i < numOfIntlFormatElements; i++) { - Element numberFormatElement = (Element) intlNumberFormatElements.item(i); - NumberFormat format = new NumberFormat(); - setLeadingDigitsPatterns(numberFormatElement, format); - format.setPattern(validateRE(numberFormatElement.getAttribute("pattern"))); - NodeList formatPattern = numberFormatElement.getElementsByTagName("format"); - if (formatPattern.getLength() != 1) { + // Extract the pattern for international format. If there is no intlFormat, default to + // using the national format. If the intlFormat is set to "NA" the intlFormat should be + // ignored. + NumberFormat intlFormat = new NumberFormat(); + setLeadingDigitsPatterns(numberFormatElement, intlFormat); + intlFormat.setPattern(numberFormatElement.getAttribute("pattern")); + NodeList intlFormatPattern = numberFormatElement.getElementsByTagName("intlFormat"); + + if (intlFormatPattern.getLength() > 1) { LOGGER.log(Level.SEVERE, - "Only one format pattern for a numberFormat element should be defined."); - throw new RuntimeException("Invalid number of format patterns for country: " + + "A maximum of one intlFormat pattern for a numberFormat element should be " + + "defined."); + throw new RuntimeException("Invalid number of intlFormat patterns for country: " + regionCode); - } - format.setFormat(validateRE(formatPattern.item(0).getFirstChild().getNodeValue())); - if (numberFormatElement.hasAttribute("carrierCodeFormattingRule")) { - format.setDomesticCarrierCodeFormattingRule(validateRE( - getDomesticCarrierCodeFormattingRuleFromElement(numberFormatElement, - nationalPrefix))); + } else if (intlFormatPattern.getLength() == 0) { + // Default to use the same as the national pattern if none is defined. + intlFormat.setFormat(nationalFormat); } else { - format.setDomesticCarrierCodeFormattingRule(carrierCodeFormattingRule); + String intlFormatPatternValue = + intlFormatPattern.item(0).getFirstChild().getNodeValue(); + if (!intlFormatPatternValue.equals("NA")) { + intlFormat.setFormat(intlFormatPatternValue); + } + hasExplicitIntlFormatDefined = true; } - metadata.addIntlNumberFormat(format); + + if (intlFormat.hasFormat()) { + metadata.addIntlNumberFormat(intlFormat); + } + } + // Only a small number of regions need to specify the intlFormats in the xml. For the majority + // of countries the intlNumberFormat metadata is an exact copy of the national NumberFormat + // metadata. To minimize the size of the metadata file, we only keep intlNumberFormats that + // actually differ in some way to the national formats. + if (!hasExplicitIntlFormatDefined) { + metadata.clearIntlNumberFormat(); } } diff --git a/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java b/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java index f00ea3aed..c25b96a5a 100644 --- a/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java +++ b/java/resources/com/google/i18n/phonenumbers/BuildMetadataJsonFromXml.java @@ -334,7 +334,7 @@ public class BuildMetadataJsonFromXml { // required PhoneNumberDesc pager = 21; toJsArray(metadata.getPager(), jsArrayBuilder); // optional bool main_country_for_code = 22 [default=false]; - if (metadata.getMainCountryForCode()) { + if (metadata.isMainCountryForCode()) { jsArrayBuilder.append(1); } else { jsArrayBuilder.append(null); diff --git a/java/src/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMap.java b/java/src/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMap.java index eebb724b8..e67217c11 100644 --- a/java/src/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMap.java +++ b/java/src/com/google/i18n/phonenumbers/CountryCodeToRegionCodeMap.java @@ -181,8 +181,10 @@ public class CountryCodeToRegionCodeMap { listWithRegionCode.add("MY"); countryCodeToRegionCodeMap.put(60, listWithRegionCode); - listWithRegionCode = new ArrayList(1); + listWithRegionCode = new ArrayList(3); listWithRegionCode.add("AU"); + listWithRegionCode.add("CC"); + listWithRegionCode.add("CX"); countryCodeToRegionCodeMap.put(61, listWithRegionCode); listWithRegionCode = new ArrayList(1); @@ -515,8 +517,9 @@ public class CountryCodeToRegionCodeMap { listWithRegionCode.add("CY"); countryCodeToRegionCodeMap.put(357, listWithRegionCode); - listWithRegionCode = new ArrayList(1); + listWithRegionCode = new ArrayList(2); listWithRegionCode.add("FI"); + listWithRegionCode.add("AX"); countryCodeToRegionCodeMap.put(358, listWithRegionCode); listWithRegionCode = new ArrayList(1); diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index 482fb34f0..e129f34cc 100644 --- a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -320,7 +320,12 @@ public class PhoneNumberUtil { Pattern.compile(VALID_PHONE_NUMBER + "(?:" + KNOWN_EXTN_PATTERNS + ")?", REGEX_FLAGS); private static final Pattern NON_DIGITS_PATTERN = Pattern.compile("(\\D+)"); - private static final Pattern FIRST_GROUP_PATTERN = Pattern.compile("(\\$1)"); + + // The FIRST_GROUP_PATTERN was originally set to $1 but there are some countries for which the + // first group is not used in the national pattern (e.g. Argentina) so the $1 group does not match + // correctly. Therefore, we use \d, so that the first group actually used in the pattern will be + // matched. + private static final Pattern FIRST_GROUP_PATTERN = Pattern.compile("(\\$\\d)"); private static final Pattern NP_PATTERN = Pattern.compile("\\$NP"); private static final Pattern FG_PATTERN = Pattern.compile("\\$FG"); private static final Pattern CC_PATTERN = Pattern.compile("\\$CC"); @@ -639,6 +644,7 @@ public class PhoneNumberUtil { * country calling code when the number is formatted in the international format, if there is a * subscriber number part that follows. An example of how this could be used: * + *
    * PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
    * PhoneNumber number = phoneUtil.parse("18002530000", "US");
    * String nationalSignificantNumber = phoneUtil.getNationalSignificantNumber(number);
@@ -657,7 +663,7 @@ public class PhoneNumberUtil {
    * 
* * Refer to the unittests to see the difference between this function and - * {@link getLengthOfGeographicalAreaCode()}. + * {@link #getLengthOfGeographicalAreaCode()}. * * @param number the PhoneNumber object for which clients want to know the length of the NDC. * @return the length of NDC of the PhoneNumber object passed in. @@ -1312,6 +1318,11 @@ public class PhoneNumberUtil { * does not contain such information. */ public PhoneNumber getExampleNumberForType(String regionCode, PhoneNumberType type) { + // Check the region code is valid. + if (!isValidRegionCode(regionCode)) { + LOGGER.log(Level.WARNING, "Invalid or unknown region code provided."); + return null; + } PhoneNumberDesc desc = getNumberDescByType(getMetadataForRegion(regionCode), type); try { if (desc.hasExampleNumber()) { @@ -1567,9 +1578,6 @@ public class PhoneNumberUtil { return 0; } PhoneMetadata metadata = getMetadataForRegion(regionCode); - if (metadata == null) { - return 0; - } return metadata.getCountryCode(); } @@ -1594,10 +1602,6 @@ public class PhoneNumberUtil { return null; } PhoneMetadata metadata = getMetadataForRegion(regionCode); - if (metadata == null) { - LOGGER.log(Level.SEVERE, "Unsupported region code provided."); - return null; - } String nationalPrefix = metadata.getNationalPrefix(); // If no national prefix was found, we return null. if (nationalPrefix.length() == 0) { diff --git a/java/src/com/google/i18n/phonenumbers/Phonemetadata.java b/java/src/com/google/i18n/phonenumbers/Phonemetadata.java index f113d18a7..de9f7c0a3 100644 --- a/java/src/com/google/i18n/phonenumbers/Phonemetadata.java +++ b/java/src/com/google/i18n/phonenumbers/Phonemetadata.java @@ -578,12 +578,16 @@ public final class Phonemetadata { intlNumberFormat_.add(value); return this; } + public PhoneMetadata clearIntlNumberFormat() { + intlNumberFormat_.clear(); + return this; + } // optional bool main_country_for_code = 22 [default = false]; private boolean hasMainCountryForCode; private boolean mainCountryForCode_ = false; public boolean hasMainCountryForCode() { return hasMainCountryForCode; } - public boolean getMainCountryForCode() { return mainCountryForCode_; } + public boolean isMainCountryForCode() { return mainCountryForCode_; } public PhoneMetadata setMainCountryForCode(boolean value) { hasMainCountryForCode = true; mainCountryForCode_ = value; diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM index 62af85dac..7d0f2a2f3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR index 5da4db1a7..007ab2e93 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU index 24ad5c8e9..b34fb0ad5 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW index 00b01734d..5e6946895 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AX b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AX new file mode 100644 index 000000000..8abd0035a Binary files /dev/null and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AX differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CC new file mode 100644 index 000000000..948af6345 Binary files /dev/null and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN index 913120f0e..c80a25456 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO index f893bd7e0..49ff9016a 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CO differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR index 08a1ab0ea..2a047bf27 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CX b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CX new file mode 100644 index 000000000..585d96a75 Binary files /dev/null and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CX differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM index 47184070d..8713673df 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC index 1b59c2321..6578ddde3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET index c6d0e6470..6aacbc5f6 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI index 982c8dd4b..bd871b6d9 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ index 443c7c935..d123c006d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH index 3cf818d24..64e2f8711 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN index 5134699a0..8354c600f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP index 4773220d5..b3246cc15 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE index 72d80a655..4c35cb29f 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM index 7c7614351..b6916497c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN index c575305a6..9045dfb2d 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR index 0b4373c5b..dd7306bcb 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD index 17917ffed..0763f61a8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ index 0c29b3d81..bf62c3e80 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MQ differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX index 15746f777..dc44efbc8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP index 3811c4450..e54df79c3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NP differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH index 8eb72c8f2..cf6ad8d50 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC index 64ab38bcc..ff4767912 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE index 2c438131b..9d9490841 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SE differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM index 4892c602a..176add7aa 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SM differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN index 095a49402..853bd4089 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SN differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY index 2863ef19e..b2256b3d8 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SY differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG index 7ce2b578d..97fd6fbf5 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US index e0f78752e..7f80f1dc1 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC index 8616e4ef5..581746840 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VC differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI index 2af1716ee..e658ba13c 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VI differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF index 43f116261..f6b6c1598 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_WF differ diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM index 2b341abb2..5e0253df3 100644 Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ZM differ diff --git a/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java b/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java index da8e8cc4b..b03f6e596 100644 --- a/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java +++ b/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java @@ -460,8 +460,7 @@ public class AsYouTypeFormatterTest extends TestCase { assertEquals("+54 9", formatter.inputDigit('9')); assertEquals("+54 91", formatter.inputDigit('1')); assertEquals("+54 9 11", formatter.inputDigit('1')); - assertEquals("+54 9 11 2", - formatter.inputDigit('2')); + assertEquals("+54 9 11 2", formatter.inputDigit('2')); assertEquals("+54 9 11 23", formatter.inputDigit('3')); assertEquals("+54 9 11 231", formatter.inputDigit('1')); assertEquals("+54 9 11 2312", formatter.inputDigit('2')); @@ -561,6 +560,91 @@ public class AsYouTypeFormatterTest extends TestCase { assertEquals("011-9876-7890", formatter.inputDigit('0')); } + public void testAYTF_MX() { + AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("MX"); + + // +52 800 123 4567 + assertEquals("+", formatter.inputDigit('+')); + assertEquals("+5", formatter.inputDigit('5')); + assertEquals("+52 ", formatter.inputDigit('2')); + assertEquals("+52 8", formatter.inputDigit('8')); + assertEquals("+52 80", formatter.inputDigit('0')); + assertEquals("+52 800", formatter.inputDigit('0')); + assertEquals("+52 800 1", formatter.inputDigit('1')); + assertEquals("+52 800 12", formatter.inputDigit('2')); + assertEquals("+52 800 123", formatter.inputDigit('3')); + assertEquals("+52 800 123 4", formatter.inputDigit('4')); + assertEquals("+52 800 123 45", formatter.inputDigit('5')); + assertEquals("+52 800 123 456", formatter.inputDigit('6')); + assertEquals("+52 800 123 4567", formatter.inputDigit('7')); + + // +52 55 1234 5678 + formatter.clear(); + assertEquals("+", formatter.inputDigit('+')); + assertEquals("+5", formatter.inputDigit('5')); + assertEquals("+52 ", formatter.inputDigit('2')); + assertEquals("+52 5", formatter.inputDigit('5')); + assertEquals("+52 55", formatter.inputDigit('5')); + assertEquals("+52 55 1", formatter.inputDigit('1')); + assertEquals("+52 55 12", formatter.inputDigit('2')); + assertEquals("+52 55 123", formatter.inputDigit('3')); + assertEquals("+52 55 1234", formatter.inputDigit('4')); + assertEquals("+52 55 1234 5", formatter.inputDigit('5')); + assertEquals("+52 55 1234 56", formatter.inputDigit('6')); + assertEquals("+52 55 1234 567", formatter.inputDigit('7')); + assertEquals("+52 55 1234 5678", formatter.inputDigit('8')); + + // +52 212 345 6789 + formatter.clear(); + assertEquals("+", formatter.inputDigit('+')); + assertEquals("+5", formatter.inputDigit('5')); + assertEquals("+52 ", formatter.inputDigit('2')); + assertEquals("+52 2", formatter.inputDigit('2')); + assertEquals("+52 21", formatter.inputDigit('1')); + assertEquals("+52 212", formatter.inputDigit('2')); + assertEquals("+52 212 3", formatter.inputDigit('3')); + assertEquals("+52 212 34", formatter.inputDigit('4')); + assertEquals("+52 212 345", formatter.inputDigit('5')); + assertEquals("+52 212 345 6", formatter.inputDigit('6')); + assertEquals("+52 212 345 67", formatter.inputDigit('7')); + assertEquals("+52 212 345 678", formatter.inputDigit('8')); + assertEquals("+52 212 345 6789", formatter.inputDigit('9')); + + // +52 1 55 1234 5678 + formatter.clear(); + assertEquals("+", formatter.inputDigit('+')); + assertEquals("+5", formatter.inputDigit('5')); + assertEquals("+52 ", formatter.inputDigit('2')); + assertEquals("+52 1", formatter.inputDigit('1')); + assertEquals("+52 15", formatter.inputDigit('5')); + assertEquals("+52 1 55", formatter.inputDigit('5')); + assertEquals("+52 1 55 1", formatter.inputDigit('1')); + assertEquals("+52 1 55 12", formatter.inputDigit('2')); + assertEquals("+52 1 55 123", formatter.inputDigit('3')); + assertEquals("+52 1 55 1234", formatter.inputDigit('4')); + assertEquals("+52 1 55 1234 5", formatter.inputDigit('5')); + assertEquals("+52 1 55 1234 56", formatter.inputDigit('6')); + assertEquals("+52 1 55 1234 567", formatter.inputDigit('7')); + assertEquals("+52 1 55 1234 5678", formatter.inputDigit('8')); + + // +52 1 541 234 5678 + formatter.clear(); + assertEquals("+", formatter.inputDigit('+')); + assertEquals("+5", formatter.inputDigit('5')); + assertEquals("+52 ", formatter.inputDigit('2')); + assertEquals("+52 1", formatter.inputDigit('1')); + assertEquals("+52 15", formatter.inputDigit('5')); + assertEquals("+52 1 54", formatter.inputDigit('4')); + assertEquals("+52 1 541", formatter.inputDigit('1')); + assertEquals("+52 1 541 2", formatter.inputDigit('2')); + assertEquals("+52 1 541 23", formatter.inputDigit('3')); + assertEquals("+52 1 541 234", formatter.inputDigit('4')); + assertEquals("+52 1 541 234 5", formatter.inputDigit('5')); + assertEquals("+52 1 541 234 56", formatter.inputDigit('6')); + assertEquals("+52 1 541 234 567", formatter.inputDigit('7')); + assertEquals("+52 1 541 234 5678", formatter.inputDigit('8')); + } + public void testAYTFMultipleLeadingDigitPatterns() { // +81 50 2345 6789 AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("JP"); diff --git a/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java b/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java index 4dffcc9a2..704e5d4f0 100644 --- a/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java +++ b/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java @@ -28,7 +28,6 @@ import java.util.NoSuchElementException; /** * Tests for {@link PhoneNumberMatcher}. This only tests basic functionality based on test metadata. - * See {@link PhoneNumberMatcherRegressionTest} for regression tests. * * @author Tom Hofmann * @see PhoneNumberUtilTest {@link PhoneNumberUtilTest} for the origin of the test data diff --git a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java index 54d1de9ae..f4a275123 100644 --- a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java +++ b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java @@ -71,6 +71,15 @@ public class PhoneNumberUtilTest extends TestCase { private static final PhoneNumber IT_NUMBER = new PhoneNumber().setCountryCode(39).setNationalNumber(236618300L). setItalianLeadingZero(true); + // Numbers to test the formatting rules from Mexico. + private static final PhoneNumber MX_MOBILE1 = + new PhoneNumber().setCountryCode(52).setNationalNumber(12345678900L); + private static final PhoneNumber MX_MOBILE2 = + new PhoneNumber().setCountryCode(52).setNationalNumber(15512345678L); + private static final PhoneNumber MX_NUMBER1 = + new PhoneNumber().setCountryCode(52).setNationalNumber(3312345678L); + private static final PhoneNumber MX_NUMBER2 = + new PhoneNumber().setCountryCode(52).setNationalNumber(8211234567L); private static final PhoneNumber NZ_NUMBER = new PhoneNumber().setCountryCode(64).setNationalNumber(33316005L); private static final PhoneNumber SG_NUMBER = @@ -177,8 +186,8 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals("0", metadata.getNationalPrefix()); assertEquals("0(?:(11|343|3715)15)?", metadata.getNationalPrefixForParsing()); assertEquals("9$1", metadata.getNationalPrefixTransformRule()); - assertEquals("$1 15 $2-$3", metadata.getNumberFormat(2).getFormat()); - assertEquals("9(\\d{4})(\\d{2})(\\d{4})", + assertEquals("$2 15 $3-$4", metadata.getNumberFormat(2).getFormat()); + assertEquals("(9)(\\d{4})(\\d{2})(\\d{4})", metadata.getNumberFormat(3).getPattern()); assertEquals("(9)(\\d{4})(\\d{2})(\\d{4})", metadata.getIntlNumberFormat(3).getPattern()); @@ -276,6 +285,9 @@ public class PhoneNumberUtilTest extends TestCase { PhoneNumberUtil.PhoneNumberType.FIXED_LINE)); assertNotNull(phoneUtil.getExampleNumberForType(RegionCode.US, PhoneNumberUtil.PhoneNumberType.MOBILE)); + // CS is an invalid region, so we have no data for it. + assertNull(phoneUtil.getExampleNumberForType(RegionCode.CS, + PhoneNumberUtil.PhoneNumberType.MOBILE)); } public void testNormaliseRemovePunctuation() { @@ -409,6 +421,26 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals("+5491187654321", phoneUtil.format(AR_MOBILE, PhoneNumberFormat.E164)); } + public void testFormatMXNumber() { + assertEquals("045 234 567 8900", phoneUtil.format(MX_MOBILE1, PhoneNumberFormat.NATIONAL)); + assertEquals("+52 1 234 567 8900", phoneUtil.format( + MX_MOBILE1, PhoneNumberFormat.INTERNATIONAL)); + assertEquals("+5212345678900", phoneUtil.format(MX_MOBILE1, PhoneNumberFormat.E164)); + + assertEquals("045 55 1234 5678", phoneUtil.format(MX_MOBILE2, PhoneNumberFormat.NATIONAL)); + assertEquals("+52 1 55 1234 5678", phoneUtil.format( + MX_MOBILE2, PhoneNumberFormat.INTERNATIONAL)); + assertEquals("+5215512345678", phoneUtil.format(MX_MOBILE2, PhoneNumberFormat.E164)); + + assertEquals("01 33 1234 5678", phoneUtil.format(MX_NUMBER1, PhoneNumberFormat.NATIONAL)); + assertEquals("+52 33 1234 5678", phoneUtil.format(MX_NUMBER1, PhoneNumberFormat.INTERNATIONAL)); + assertEquals("+523312345678", phoneUtil.format(MX_NUMBER1, PhoneNumberFormat.E164)); + + assertEquals("01 821 123 4567", phoneUtil.format(MX_NUMBER2, PhoneNumberFormat.NATIONAL)); + assertEquals("+52 821 123 4567", phoneUtil.format(MX_NUMBER2, PhoneNumberFormat.INTERNATIONAL)); + assertEquals("+528211234567", phoneUtil.format(MX_NUMBER2, PhoneNumberFormat.E164)); + } + public void testFormatOutOfCountryCallingNumber() { assertEquals("00 1 900 253 0000", phoneUtil.formatOutOfCountryCallingNumber(US_PREMIUM, RegionCode.DE)); diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR index 26edd0080..80e8ebf2c 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_AR differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX index ee4a967a4..7f1e18b1f 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_MX differ diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US index 34d2f220f..9e6ba6965 100644 Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_US differ diff --git a/resources/PhoneNumberMetaData.xml b/resources/PhoneNumberMetaData.xml index 748ce21c6..58f31079f 100644 --- a/resources/PhoneNumberMetaData.xml +++ b/resources/PhoneNumberMetaData.xml @@ -53,13 +53,13 @@ - + - - + + @@ -78,8 +78,6 @@ - - ]> @@ -512,23 +510,21 @@ nationalPrefix="0" nationalPrefixFormattingRule="($NP$FG)"> + 1 + $1 $2 + + - [17]| + [5-7]| 9[1-9] $1 $2 - - 6 - $1 $2 - [23] $1 $2 - + 8| 90 @@ -537,7 +533,7 @@ - [1-36-9]\d{7} + [1-35-9]\d{7} \d{5,8} @@ -558,8 +554,11 @@ 10123456 + (?: + 55| 77| 9[1-46-9] )\d{6} @@ -724,43 +723,12 @@ [68] $1-$2-$3 - - [68] - $1-$2-$3 - - - 91 - $1 15-$2-$3 - - - 91 - 9 $1 $2-$3 - - - - 9(?: - 2[2369]| - 3[458] - ) - - - 9(?: - 2(?: - 2[013]| - 37| - 6[14]| - 9[179] - )| - 3(?: - 4[1235]| - 5[138]| - 8[1578] - ) - ) - - $1 15-$2-$3 + + 911 + $2 15-$3-$4 + $1 $2 $3-$4 - + 9(?: 2[2369]| @@ -782,36 +750,10 @@ ) ) - 9 $1 $2-$3 - - - - 9(?: - 2[2-469]| - 3[3-578] - ) - - - 9(?: - 2(?: - 2[24-9]| - 3[0-69]| - 47| - 6[25]| - 9[02-68] - )| - 3(?: - 3[28]| - 4[046-9]| - 5[2467]| - 7[1-578]| - 8[23469] - ) - ) - - $1 15-$2-$3 + $2 15-$3-$4 + $1 $2 $3-$4 - + 9(?: 2[2-469]| @@ -836,16 +778,13 @@ ) ) - 9 $1 $2-$3 - + $2 15-$3-$4 + $1 $2 $3-$4 + 1 $1 $2-$3 - - 1 - $1 $2-$3 - @@ -864,30 +803,10 @@ $1 $2-$3 - - - 2(?: - 2[013]| - 37| - 6[14]| - 9[179] - )| - 3(?: - 4[1235]| - 5[138]| - 8[1578] - ) - - $1 $2-$3 - [23] $1 $2-$3 - - [23] - $1 $2-$3 - [1-9]\d{9,11} @@ -1178,11 +1097,12 @@ - + + + nationalPrefix="0" mainCountryForCode="true"> @@ -1234,7 +1154,21 @@ \d{6,10} - [2378]\d{8} + + + [237]\d{8}| + 8(?: + [68]\d{3}| + 7[1-4]\d{2}| + 9(?: + [02-9]\d{2}| + 1(?: + [0-57-9]\d| + 6[0135-9] + ) + ) + )\d{4} + \d{8,9} 212345678 @@ -1294,39 +1228,42 @@ - + $1 $2 - [5-9]\d{6} + [25-9]\d{6} \d{7} 5(?: - 2\d{2}| - 8(?: - [2-7]\d| - 8[0-79]| - 9[48] - ) - )\d{3} + 2\d| + 8[1-9] + )\d{4} 5212345 - + (?: - 5[69]\d| - 660| - 9(?: + 5(?: 6\d| - 9[02-9] + 9[2-478] + )| + 6(?: + [039]0| + 22| + [46][01] )| - 7[34]\d + 7[34]\d| + 9(?: + 6[45]| + 9[4-8] + ) )\d{4} 5601234 @@ -1339,6 +1276,77 @@ 900\d{4} 9001234 + + + 28\d{5}| + 501\d{4} + + 5011234 + + + + + + + + + + + [135]\d{5,9}| + [27]\d{4,9}| + 4\d{5,10}| + 6\d{7,8}| + 8\d{6,9} + + \d{5,12} + + + 18[1-8]\d{3,9} + \d{6,12} + 1812345678 + + + + + 4\d{5,10}| + 50\d{4,8} + + \d{6,11} + 412345678 + + + 800\d{4,7} + \d{7,10} + 8001234567 + + + [67]00\d{5,6} + \d{8,9} + 600123456 + + + + 10[1-9]\d{3,7}| + 2(?: + 0(?: + [16-8]\d{3,7}| + 2[14-9]\d{1,6}| + [3-5]\d{2,7}| + 9[0-7]\d{1,6} + )| + 9\d{4,8} + )| + 30[1-9]\d{3,7}| + 7(?: + 1\d{7}| + 3\d{8}| + 5[03-9]\d{2,7} + ) + + \d{5,10} + 10112345 + @@ -2929,6 +2937,72 @@ + + + + + + + + + + [1458]\d{5,9} + \d{6,10} + + + 89162\d{4} + \d{8,9} + 891621234 + + + + + 4(?: + [0-2]\d| + 3[0-57-9]| + 4[47-9]| + 5[0-37-9]| + 6[6-9]| + 7[07-9]| + 8[7-9] + )\d{6} + + \d{9} + 412345678 + + + + 1(?: + 80(?: + 0\d{2} + )? | + 3(?: + 00\d{2} + )? + )\d{4} + + \d{6,10} + 1800123456 + + + 190[0126]\d{6} + \d{10} + 1900123456 + + + 500\d{6} + \d{9} + 500123456 + + + 550\d{6} + \d{9} + 550123456 + + + - + 80[2678] $1 $2 @@ -3358,14 +3431,13 @@ [2-9] $1 $2 + NA - + 21 $1 $2 $3 - + 10[1-9]| 2[02-9] @@ -3387,8 +3459,7 @@ $1 $2 $3 - + 3(?: 11| @@ -3411,8 +3482,7 @@ $1 $2 $3 - + 3(?: 1[02-9]| @@ -3480,133 +3550,6 @@ 10800 $1 $2 $3 - - 21 - $1 $2 $3 - - - - 10[1-9]| - 2[02-9] - - - - 10[1-9]| - 2[02-9] - - - 10(?: - [1-79]| - 8(?: - [1-9]| - 0[1-9] - ) - )| - 2[02-9] - - $1 $2 $3 - - - 80[2678] - $1 $2 - - - - 3(?: - 11| - 7[159] - )| - 4[135]1| - 5(?: - 1| - 2[37]| - 3[12]| - 7[13-79]| - 9[15] - )| - 7(?: - 31| - 5[457]| - 6[09] - )| - 898 - - $1 $2 $3 - - - - 3(?: - 1[02-9]| - 35| - 49| - 5| - 7[02-68]| - 9[1-68] - )| - 4(?: - 1[02-9]| - 2[179]| - [35][2-9]| - 6[4789]| - 7[0-46-9]| - 8[23] - )| - 5(?: - 3[03-9]| - 4[36]| - 5| - 6[1-6]| - 7[028]| - 80| - 9[2-46-9] - )| - 6(?: - 3[1-5]| - 6[0238]| - 9[12] - )| - 7(?: - 01| - [1579]| - 2[248]| - 3[04-9]| - 4[3-6]| - 6[2368] - )| - 8(?: - 1[236-8]| - 2[5-7]| - [37]| - 5[1-9]| - 8[3678]| - 9[1-7] - )| - 9(?: - 0[1-3689]| - 1[1-79]| - [379]| - 4[13]| - 5[1-5] - ) - - $1 $2 $3 - - - 1[3-58] - $1 $2 $3 - - - [48]00 - $1 $2 $3 - - - 108 - 1080 - 10800 - $1 $2 $3 - @@ -3705,12 +3648,13 @@ 1012345678 + 1(?: - 3[0-9]| - 47| - 5[0135689]| - 8[05-9] + 3\d| + 4[57]| + 5[0-35-9]| + 8[025-9] )\d{8} \d{11} @@ -3743,34 +3687,12 @@ - - - - - 1(?: - 8[2-9]| - 9[0-3]| - [2-7] - )| - [24-8] - - - 1(?: - 8[2-9]| - 9(?: - 09| - [1-3] - )| - [2-7] - )| - [24-8] - - $1 $2 - - + http://en.wikipedia.org/wiki/Telephone_numbers_in_Colombia --> + + + 1(?: 8[2-9]| @@ -3791,15 +3713,11 @@ [24-8] $1 $2 - + 3 $1 $2 - - 3 - $1 $2 - 1(?: @@ -3817,25 +3735,8 @@ ) $1-$2-$3 + $1 $2 $3 - - - 1(?: - 80| - 9[04] - ) - - - 1(?: - 800| - 9(?: - 0[01]| - 4[78] - ) - ) - - $1 $2 $3 - @@ -3906,14 +3807,9 @@ 22123456 - - - 8(?: - [389]\d| - 7[0-3] - )\d{5} - + 8[36789]\d{6} \d{8} 83123456 @@ -4081,6 +3977,72 @@ + + + + + + + + + + [1458]\d{5,9} + \d{6,10} + + + 89164\d{4} + \d{8,9} + 891641234 + + + + + 4(?: + [0-2]\d| + 3[0-57-9]| + 4[47-9]| + 5[0-37-9]| + 6[6-9]| + 7[07-9]| + 8[7-9] + )\d{6} + + \d{9} + 412345678 + + + + 1(?: + 80(?: + 0\d{2} + )? | + 3(?: + 00\d{2} + )? + )\d{4} + + \d{6,10} + 1800123456 + + + 190[0126]\d{6} + \d{10} + 1900123456 + + + 500\d{6} + \d{9} + 500123456 + + + 550\d{6} + \d{9} + 550123456 + + + @@ -4501,6 +4463,7 @@ 7674201234 + 767(?: 2(?: @@ -4508,7 +4471,7 @@ 7[5-7] )| 31[5-7]| - 61[4-6] + 61[4-7] )\d{4} \d{10} @@ -4687,29 +4650,18 @@ [2-7] $1 $2-$3 + $1-$2-$3 - - [2-7] - $1-$2-$3 - [89] $1 $2 $3 - - [89] - $1 $2 $3 - 1 $1 $2 $3 - - 1 - $1 $2 $3 - [2-9]\d{7}|1\d{9,10} @@ -5174,16 +5126,17 @@ - 91[0-8]\d{6} + 9[12]\d{7} \d{9} 911234567 + - + @@ -5214,11 +5167,11 @@ \d{5,12} - + 1(?: - [35689][1-8]\d{3,9}| + [3569][1-8]\d{3,9}| [47]\d{5,10} )| 2[1-8]\d{3,9}| @@ -5226,7 +5179,7 @@ [1-8]\d{3,9}| 9\d{4,8} )| - [5689][1-8]\d{3,9}| + [5689][1-8]\d{3,9} 1312345678 @@ -5267,7 +5220,7 @@ 5[03-9]\d{2,7} ) - \d{6,10} + \d{5,10} 10112345 @@ -5309,10 +5262,12 @@ 3212345 + (?: 7[0-4]| - 9[29] + 9[27-9] )\d{5} \d{7} @@ -5530,6 +5485,7 @@ 810123456 + 9\d{8} 912345678 @@ -6555,15 +6511,12 @@ 302345678 + - 2(?: - (?: - [47]\d| - 08 - )\d{6}| - [368]\d{7} - )| - 54\d{7} + (?: + 2[034678]| + 54 + )\d{7} \d{9} 231234567 @@ -8202,44 +8155,140 @@ 7(?: 2[0579]| - 39| + 3[057-9]| 4[0-389]| - 5[04-9]| - 6| - 7[02-9]| - 8[0-79] + 5[024-9]| + 6[0-35-9]| + 7[03469]| + 8[0-4679] )| 8(?: 0[01589]| - 1[024]| - 8[0479]| - 9[057-9] + 1[0-479]| + 2[236-9]| + 3[0479]| + 4[0-68]| + 5[0-579] + 6[05789] + 7[12569]| + 8[0124-9]| + 9[02-9] )| 9 7(?: - 2[0579]| - 39| - 4[0-389]| + 2(?: + 0[04-9]| + 5[09]| + 7[5-8]| + 9[389] + )| + 3(?: + 0[134679]| + 5[0-489]| + 7[3679]| + 8[3-9]| + 9[689] + )| + 4(?: + 0[4579]| + 1[15-9]| + [29][89]| + 39| + 8[389] + )| 5(?: - 0[0-5]| - 49| - 50| - [6-9] + 0[0-5789]| + [47]9| + [25]0| + 6[6-9]| + [89][7-9] + )| + 6(?: + 0[027]| + 12| + 20| + 3[19]| + 5[45]| + 6[5-9]| + 7[679]| + 9[6-9] + )| + 7(?: + 0[27-9]| + 3[5-9]| + 42| + 60| + 9[5-9] )| - 6| - 7[02-9]| - 8[0-79] + 8(?: + [03][07-9]| + 14| + 2[7-9]| + 4[25]| + 6[09]| + 7| + 9[013-9] + ) )| 8(?: 0[01589]| - 1[024]| + 1(?: + [024]| + 15| + 30| + 7[19]| + 97 + )| + 2(?: + [2369]| + 7[0135]| + 8[67] + )| + 3(?: + 0[235-8]| + 4[179]| + 74| + 90 + )| + 4(?: + [02-58]| + 10| + 6[09] + )| + 5(?: + 0[079]| + [19]1| + 2| + 30| + 4[47]| + 53| + 7[45] + )| + 6(?: + [0589]| + 70 + )| + 7(?: + 1[24]| + [2569] + )| 8(?: - [079]| - 44 + [07-9]| + 17| + 2[024-8]| + 44| + 5[389]| + 6[0167] )| - 9[057-9] + 9(?: + [057-9]| + 2[35-9]| + 3[09]| + 4[038]| + 6[0-27-9] + ) )| 9 @@ -8253,11 +8302,11 @@ 33| 4[04]| 79| - 80[2-6] + 80[2-46] $1 $2 $3 - + 1(?: @@ -8268,12 +8317,7 @@ 7[1257]| 8[1346]| [68][1-9] - ) - - $1 $2 $3 - - - + )| 2(?: 1[257]| 3[013]| @@ -8283,12 +8327,7 @@ 78| 8[1568]| 9[14] - ) - - $1 $2 $3 - - - + )| 3(?: 26| 4[1-3]| @@ -8296,12 +8335,7 @@ 6[01489]| 7[02-46]| 8[159] - ) - - $1 $2 $3 - - - + )| 4(?: 1[36]| 2[1-47]| @@ -8311,12 +8345,7 @@ 7[0-24-9]| 8[013-57]| 9[014-7] - ) - - $1 $2 $3 - - - + )| 5(?: [136][25]| 22| @@ -8324,12 +8353,7 @@ 5[12]| [78]1| 9[15] - ) - - $1 $2 $3 - - - + )| 6(?: 12| [2345]1| @@ -8341,6 +8365,7 @@ $1 $2 $3 + 7(?: @@ -8361,7 +8386,7 @@ 4[47]| 5(?: 1| - 5[1-9] + 5[2-6] )| [67]1| 88 @@ -8422,21 +8447,20 @@ \d{6,12} - + (?: 11| 2[02]| 33| 4[04]| - 79| - 80 + 79 )[2-6]\d{7}| + 80[2-46]\d{7}| (?: 1(?: 2[0-249]| @@ -8605,35 +8629,43 @@ - + (?: 7(?: 2(?: 0[04-9]| 5[09]| - 7[568]| - 9[39] + 7[5-8]| + 9[389] )| 3(?: - 07| + 0[134679]| + 5[0-489]| 7[3679]| + 8[3-9]| 9[689] )| 4(?: - 05| + 0[4579]| 1[15-9]| [29][89]| 39| 8[389] )| 5(?: - 0[0-5]| + 0[0-5789]| [47]9| - 50| + [25]0| 6[6-9]| [89][7-9] )| @@ -8644,15 +8676,14 @@ 3[19]| 5[45]| 6[5-9]| - 7[67]| + 7[679]| 9[6-9] )| 7(?: - 0[289]| - 3[5-9]| + 0[27-9]| + [39][5-9]| 42| - 60| - 9[5-9] + 60 )| 8(?: [03][07-9]| @@ -8660,28 +8691,71 @@ 2[7-9]| 4[25]| 6[09]| - 7[015689]| - 9[0357-9] + 7\d| + 9[013-9] ) - )\d| - 9\d{4}| + )| 8(?: - (?: - 0[01589]| - 1[24]| - 2[2369]| - 4[023458]| + 0[01589]\d| + 1(?: + [024]\d| + 15| + 30| + 7[19]| + 97 + )| + 2(?: + [2369]\d| 52| - 6[0589]| - 7[2569] - )\d| + 7[0135]| + 8[67] + )| + 3(?: + 0[235-8]| + 4[179]| + 74| + 90 + )| + 4(?: + [02-58]\d| + 10| + 6[09] + )| + 5(?: + 0[079]| + [19]1| + 2\d| + 30| + 4[47]| + 53| + 7[45] + )| + 6(?: + [0589]\d| + 7[09] + )| + 7(?: + 1[24]| + [2569]\d + )| 8(?: - [079]\d| - 44 + [07-9]\d| + 17| + 2[024-8]| + 44| + 5[389]| + 6[0167] )| - 9[057-9]\d - )\d - )\d{5} + 9(?: + [057-9]\d| + 2[35-9]| + 3[09]| + 4[038]| + 6[0-27-9] + ) + )| + 9\d{3} + )\d{6} \d{10} 9123456789 @@ -9494,16 +9568,21 @@ - + (?: 12| + 57| 99 )0 $1-$2-$3 + + 800 + $1-$2-$3 + - [57-9]0 + + [2579]0| + 80[1-9] + $1-$2-$3 + + 20\d{8} + \d{10} + 2012345678 + - 120\d{6} - \d{9} + + 120\d{6}| + 800\d{7} + + \d{9,10} 120123456 @@ -10332,7 +10425,6 @@ \d{9} 990123456 - 60\d{7} \d{9} @@ -10343,6 +10435,12 @@ \d{10} 5012345678 + + + 570\d{6} + \d{9} + 570123456 + @@ -10382,14 +10480,13 @@ 202012345 - + 7(?: - 1[0-6]| - 2\d| - 3[2-8]| - 5[0-2]| - 7[023] + 0[0-3]| + [123]\d| + 5[0-3]| + 7[0-4] )\d{6} \d{9} @@ -10643,7 +10740,7 @@ - [37]\d{6} + [379]\d{6} \d{7} @@ -10661,6 +10758,17 @@ 3[23]\d{5} 3212345 + + + + (?: + 39[01]| + 9[01]0 + )\d{4} + + 9001234 + @@ -10673,12 +10781,15 @@ \d{7}(?:\d{3})? + 869(?: 2(?: 29| 36 )| + 302| 4(?: 6[5-9]| 70 @@ -10688,14 +10799,15 @@ 8692361234 + 869(?: 5(?: 5[6-8]| 6[5-7] )| - 66[2-9]| - 76[2-5] + 66\d| + 76[02-6] )\d{4} \d{10} @@ -11669,15 +11781,20 @@ [4-6] $1 $2 $3 + + [38] + $1 $2 $3 + (?: [279]\d| - [4-6] + [4-6]| + [38]\d{2} )\d{6} - \d{7,8} + \d{7,9} 2\d{7} @@ -11685,13 +11802,15 @@ 21234567 - + (?: 4[67]| 5\d| 6[4-8]| - 7\d{2} + 7\d{2}| + 880\d )\d{5} 4612345 @@ -11702,6 +11821,13 @@ \d{8} 90123456 + + + 33200\d{4} + \d{9} + 332001234 + @@ -12243,6 +12369,7 @@ + @@ -12257,7 +12384,7 @@ $1 $2 $3 - + [89] $1 $2 @@ -12289,10 +12416,12 @@ 22212345 - + (?: 6(?: + 0[0-3]| 50| 7[12]| [89]\d @@ -12310,9 +12439,49 @@ 80012345 - 900\d{5} + 90[056]\d{5} 90012345 + + + 808\d{5} + 80812345 + + + + + 8(?: + 03| + 14 + )\d{5} + + 80312345 + + + + 1(?: + 1(?: + [279]| + 6(?: + 000| + 1(?: + 11| + 23 + ) + )| + 8\d + )| + 4\d{3}| + 5[0-3]\d| + 6[0-389]\d| + 8\d{2}| + 9[0-4]\d + ) + + \d{3,6} + 116000 + @@ -12943,8 +13112,42 @@ + + nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG"> + + + $1 $2 $3 $4 + + + + [56]\d{8} + \d{9} + + + + 596(?: + 3[0789]| + 4[28]| + [5-7]\d| + 9[67] + )\d{4} + + 596301234 + + + + 696(?: + [2-49]\d| + 7[0-4]| + 8[0-6] + )\d{4} + + 696201234 + + @@ -13350,14 +13553,6 @@ $1 $2 $3 - - - 33| - 55| - 81 - - $1 $2 $3 - [2467]| @@ -13368,18 +13563,7 @@ $1 $2 $3 - - - [2467]| - 3[12457-9]| - 5[89]| - 8[02-9]| - 9[0-35-9] - - $1 $2 $3 - - + 1(?: 33| @@ -13387,20 +13571,10 @@ 81 ) - 045 $1 $2 $3 + 045 $2 $3 $4 + $1 $2 $3 $4 - - - 1(?: - 33| - 55| - 81 - ) - - $1 $2 $3 $4 - - + 1(?: [2467]| @@ -13410,20 +13584,9 @@ 9[1-35-9] ) - 045 $1 $2 $3 + 045 $2 $3 $4 + $1 $2 $3 $4 - - - 1(?: - [2467]| - 3[12457-9]| - 5[89]| - 8[2-9]| - 9[1-35-9] - ) - - $1 $2 $3 $4 - [1-9]\d{9,10} @@ -14271,42 +14434,57 @@ - - 1[4-6] - $1 $2 $3 + + + 1[2-6] + $1-$2 - + 1[01]| [2-8]| - 9[1-79] + 9(?: + [1-69]| + 7[15-9] + ) - $1 $2 $3 + $1-$2 - - - 98 - $1 $2 $3 + + + 9(?: + 7[45]| + 8 + ) + + $1-$2 + - [1-8]\d{5,7}| - 98[45]\d{7} + [1-8]\d{7}| + 9(?: + [1-69]\d{6}| + 7[2-6]\d{5,7}| + 8\d{8} + ) \d{6,10} + (?: - 1[014-6]| + 1[0124-6]| 2[13-79]| 3[135-8]| 4[146-9]| 5[135-7]| 6[13-9]| 7[15-9]| - 8[1-4679]| + 8[1-46-9]| 9[1-79] )\d{6} @@ -14316,7 +14494,12 @@ - 98[45]\d{7} + + 9(?: + 7[45]| + 8[0145] + )\d{7} + \d{10} 9841234567 @@ -14807,8 +14990,10 @@ 1[025-9]| 2[0-36-9]| 3[0235-9]| + 4[89]| 7[349]| - [89]9 + 89| + 9[49] )\d{7} \d{10} @@ -15823,13 +16008,21 @@ - [23578]| - [46][0-35-9] + [3578]| + 2[1-4689]| + 6(?: + [0-35-9]| + 4[0-689] + ) $1 $2 - [46]4 + + 2[57]| + 4[2-46]| + 647 + $1 $2 $3 @@ -15842,61 +16035,67 @@ cannot find any evidence that they are more expensive to call than other Fixed Line services. ISDN and DID services are here too, since they seem to be also fixed-line phone numbers. --> + (?: - 2(?: - 1[78]| - 2[14-69]| - 3[2-4]| - 4[1-36-8]| - 6[167]| - [89]\d + 2?(?: + 55[0-5]| + 78[013] )| - 3(?: - 2[1-6]| - 4[4-6]| - 55| - 6[016]| - 7\d| - 8[0-589]| - 9[0-5] - )| - 5(?: - 5\d| - 6[0-2] - )| - 6(?: - 0[0-27-9]| - 1[0-478]| - 2[145]| - 3[02-4]| - 4[124]| - 6[015]| - 7\d| - 8[1-3] - )| - 78[0138] + 4?(?: + 2(?: + 1[78]| + 2[14-69]| + 3[2-4]| + 4[1-36-8]| + 6[167]| + [89]\d + )| + 3(?: + 0[34]| + 2[1-6]| + 4[4-6]| + 55| + 6[016]| + 7\d| + 8[0-589]| + 9[0-5] + )| + 6(?: + 0[0-256]| + 1[0-478]| + 2[145]| + 3[02-4]| + 4[124]| + 6[015]| + 7\d| + 8[1-3] + ) + ) )\d{3} - \d{6} - 217123 + \d{6,7} + 4217123 + - (?: + 2?(?: 5(?: - [1247-9]\d| - 6[3-9] + [0-46-9]\d| + 5[6-9] )| 7(?: - [14679]\d| - 2[1-9]| - 8[24-79] + [0-79]\d| + 8[24-9] ) )\d{3} - \d{6} - 510123 + \d{6,7} + 2510123 8000\d{2} @@ -15954,11 +16153,8 @@ 8 $1-$2 $3 $4 + $1 $2 $3 $4 - - 8 - $1 $2 $3 $4 - 1[013689]| @@ -15970,19 +16166,8 @@ 90 $1-$2 $3 $4 + $1 $2 $3 $4 - - - 1[013689]| - 2[0136]| - 3[1356]| - 4[0246]| - 54| - 6[03]| - 90 - - $1 $2 $3 $4 - 1[13689]| @@ -15994,19 +16179,8 @@ 90 $1-$2 $3 + $1 $2 $3 - - - 1[13689]| - 2[136]| - 3[1356]| - 4[0246]| - 54| - 6[03]| - 90 - - $1 $2 $3 - 1[2457]| @@ -16022,23 +16196,8 @@ ) $1-$2 $3 $4 + $1 $2 $3 $4 - - - 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] - ) - - $1 $2 $3 $4 - 1[2457]| @@ -16054,47 +16213,23 @@ ) $1-$2 $3 + $1 $2 $3 - - - 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] - ) - - $1 $2 $3 - 7[02-467] $1-$2 $3 $4 + $1 $2 $3 $4 - - 7[02-467] - $1 $2 $3 $4 - 20 $1-$2 $3 + $1 $2 $3 - - 20 - $1 $2 $3 - 9[034] $1-$2 $3 $4 + $1 $2 $3 $4 - - 9[034] - $1 $2 $3 $4 - \d{7,10} @@ -16149,7 +16284,7 @@ )| 5(?: 0[0-6]| - 1[1-5]| + 1[0-5]| 2[0-68]| 3[0-4]| 4\d| @@ -16626,31 +16761,21 @@ [5-7] $1 $2 $3 $4 - - [5-7] - $1 $2 $3 $4 - 0 $1 $2 + + ($1) $2 - - - 0 - ($1) $2 - [89] 0549 $1 + (0549) $1 - - [89] - (0549) $1 - [05-7]\d{7,9} @@ -16711,8 +16836,10 @@ 301012345 - + 7(?: 0[1256]0| @@ -16722,19 +16849,15 @@ 3[3489]| 4[6-9]| 5[1-389]| - 6[6-9]| + 6[5-9]| 7[45]| 8[3-8] )| 7(?: + 01| 1[014-8]| - 2[0-7]| - 3[0-35-8]| - 4[0-6]| - [56]\d| - 7[0-589]| - 8[01]| - 9[0-6] + [2-79]\d| + 8[019] ) )\d{5} @@ -16912,8 +17035,8 @@ 112345678 - + 9(?: 3[23]| @@ -16921,7 +17044,7 @@ 55| 6[67]| 88| - 9[19] + 9[1-49] )\d{6} \d{9} @@ -17971,9 +18094,10 @@ 312345678 + 7(?: - [1578]\d| + [15789]\d| 0[0-4] )\d{6} @@ -18007,15 +18131,14 @@ ($1) $2-$3 + + $1-$2-$3 $1-$2 + NA - - - $1-$2-$3 - [2-9]\d{9} @@ -18334,16 +18457,18 @@ 7842661234 + 784(?: 4(?: - 3[0-24]| + 3[0-4]| 5[45]| 9[2-5] )| 5(?: 2[6-9]| - 3[0-3]| + 3[0-4]| 93 ) )\d{4} @@ -18529,10 +18654,41 @@ \d{7}(?:\d{3})? + 340(?: - 6[49]2| - 7[17]\d + 2(?: + 01| + 2[07]| + 36| + 44| + 77 + )| + 3(?: + 32| + 44 + )| + 4(?: + 4[38]| + 7[34] + )| + 5(?: + 1[34]| + 55 + )| + 6(?: + 26| + 4[23]| + 9[023] + )| + 7(?: + [17]\d| + 27 + )| + 884| + 998 )\d{4} 3406421234 @@ -18540,8 +18696,36 @@ 340(?: - 6[49]2| - 7[17]\d + 2(?: + 01| + 2[07]| + 36| + 44| + 77 + )| + 3(?: + 32| + 44 + )| + 4(?: + 4[38]| + 7[34] + )| + 5(?: + 1[34]| + 55 + )| + 6(?: + 26| + 4[23]| + 9[023] + )| + 7(?: + [17]\d| + 27 + )| + 884| + 998 )\d{4} 3406421234 @@ -18706,8 +18890,40 @@ - - + + + + + + $1 $2 $3 + + + + [5-7]\d{5} + \d{6} + + + + + (?: + 50| + 68| + 72 + )\d{4} + + 501234 + + + + (?: + 50| + 68| + 72 + )\d{4} + + 501234 + @@ -18931,12 +19147,12 @@ 211234567 - 9(?: 55| - 6[4-9]| + 6[3-9]| 7[4-9] )\d{6} diff --git a/resources/PhoneNumberMetaDataForTesting.xml b/resources/PhoneNumberMetaDataForTesting.xml index 661bdd2b4..951c64ea5 100644 --- a/resources/PhoneNumberMetaDataForTesting.xml +++ b/resources/PhoneNumberMetaDataForTesting.xml @@ -17,7 +17,7 @@ MetaData on Phone Number Plan and formatting rules. This file is used solely for the purpose of unittesting, so data in this file is not necessarily consistent with that of - ../src/PhoneNumberMetaData.xml + ../resources/PhoneNumberMetaData.xml --> @@ -67,39 +67,21 @@ 1[02-9]|[23] $1 $2-$3 - + 911 - $1 15 $2-$3 + $2 15 $3-$4 + $1 $2 $3 $4 - 9(?:1[02-9]|[23]) - $1 $2-$3 + $2 $3-$4 + $1 $2 $3 $4 [68] $1-$2-$3 - - 11 - $1 $2-$3 - - - 1[02-9]|[23] - $1 $2-$3 - - - 911 - $1 $2 $3 $4 - - - 9(?:1[02-9]|[23]) - $1 $2 $3 $4 - - - [68] - $1-$2-$3 - [1-3689]\d{9,10} @@ -489,7 +471,7 @@ + nationalPrefixTransformRule="1$1" nationalPrefixFormattingRule="$NP $FG"> [89]00 @@ -503,34 +485,16 @@ [2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9] $1 $2 $3 - + 1(?:33|55|81) - 045 $1 $2 $3 + 045 $2 $3 $4 + $1 $2 $3 $4 - + 1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9]) - 045 $1 $2 $3 + 045 $2 $3 $4 + $1 $2 $3 $4 - - [89]00 - $1 $2 $3 - - - 33|55|81 - $1 $2 $3 - - - [2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9] - $1 $2 $3 - - - 1(?:33|55|81) - $1 $2 $3 $4 - - - 1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9]) - $1 $2 $3 $4 - [1-9]\d{9,10} @@ -713,10 +677,8 @@ $1 $2 - - - $1 $2 $3 - + NA + [13-9]\d{9}|2[0-35-9]\d{8}