diff --git a/java/release_notes.txt b/java/release_notes.txt index 5784e0ed8..c6a9d97eb 100644 --- a/java/release_notes.txt +++ b/java/release_notes.txt @@ -1,3 +1,13 @@ +Apr 26th, 2011 +* Code changes: + - Improved PhoneNumberMatcher for cases with other numbers before or after the phone number. + - Improved AsYouTypeFormatter not to use formatting rules containing non-formatting characters + (e.g. '*' in Israeli star numbers). +* Metadata changes: + - New countries: FJ, FM, GY, NF, NI, NR, TV. + - Updates: AM, AZ, BF, BW, BZ, CI, CR, GB, GP, HK, JM, KH, LB, LY, MV, PE, PK, SZ, TJ, US. +* Minor documentation updates + Apr 11th, 2011 * Bug fixes: - Adding date exclusion pattern in PhoneNumberMatcher. diff --git a/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java b/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java index 1dac89a1a..0080de93c 100644 --- a/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java +++ b/java/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java @@ -28,11 +28,11 @@ import java.util.regex.Pattern; /** * A formatter which formats phone numbers as they are entered. * - *

An AsYouTypeFormatter could be created by invoking - * {@link PhoneNumberUtil#getAsYouTypeFormatter}. After that digits could be added by invoking + *

An AsYouTypeFormatter can be created by invoking + * {@link PhoneNumberUtil#getAsYouTypeFormatter}. After that, digits can be added by invoking * {@link #inputDigit} on the formatter instance, and the partially formatted phone number will be - * returned each time a digit is added. {@link #clear} could be invoked before a new number needs to - * be formatted. + * returned each time a digit is added. {@link #clear} can be invoked before formatting a new + * number. * *

See the unittests for more details on how the formatter is to be used. * @@ -66,6 +66,15 @@ public class AsYouTypeFormatter { // the phone number can be as long as 15 digits. private static final Pattern STANDALONE_DIGIT_PATTERN = Pattern.compile("\\d(?=[^,}][^,}])"); + // A pattern that is used to determine if a numberFormat under availableFormats is eligible to be + // used by the AYTF. It is eligible when the format element under numberFormat contains groups of + // the dollar sign followed by a single digit, separated by valid phone number punctuation. This + // prevents invalid punctuation (such as the star sign in Israeli star numbers) getting into the + // output of the AYTF. + private static final Pattern ELIGIBLE_FORMAT_PATTERN = + Pattern.compile("[" + PhoneNumberUtil.VALID_PUNCTUATION + "]*" + + "(\\$\\d" + "[" + PhoneNumberUtil.VALID_PUNCTUATION + "]*)+"); + // This is the minimum length of national number accrued that is required to trigger the // formatter. The first element of the leadingDigitsPattern of each numberFormat contains a // regular expression that matches up to this number of digits. @@ -134,10 +143,18 @@ public class AsYouTypeFormatter { (isInternationalFormatting && currentMetaData.intlNumberFormatSize() > 0) ? currentMetaData.intlNumberFormats() : currentMetaData.numberFormats(); - possibleFormats.addAll(formatList); + for (NumberFormat format : formatList) { + if (isFormatEligible(format.getFormat())) { + possibleFormats.add(format); + } + } narrowDownPossibleFormats(leadingThreeDigits); } + private boolean isFormatEligible(String format) { + return ELIGIBLE_FORMAT_PATTERN.matcher(format).matches(); + } + private void narrowDownPossibleFormats(String leadingDigits) { int indexOfLeadingDigitsPattern = leadingDigits.length() - MIN_LEADING_DIGITS_LENGTH; Iterator it = possibleFormats.iterator(); @@ -179,7 +196,7 @@ public class AsYouTypeFormatter { return false; } - // Gets a formatting template which could be used to efficiently format a partial number where + // Gets a formatting template which can be used to efficiently format a partial number where // digits are added one by one. private String getFormattingTemplate(String numberPattern, String numberFormat) { // Creates a phone number consisting only of the digit 9 that matches the @@ -196,7 +213,7 @@ public class AsYouTypeFormatter { } /** - * Clears the internal state of the formatter, so it could be reused. + * Clears the internal state of the formatter, so it can be reused. */ public void clear() { currentOutput = ""; @@ -234,7 +251,7 @@ public class AsYouTypeFormatter { /** * Same as {@link #inputDigit}, but remembers the position where {@code nextChar} is inserted, so - * that it could be retrieved later by using {@link #getRememberedPosition}. The remembered + * that it can be retrieved later by using {@link #getRememberedPosition}. The remembered * position will be automatically adjusted if additional formatting characters are later * inserted/removed in front of {@code nextChar}. */ diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java b/java/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java index 09bc51e57..09eb35c4b 100644 --- a/java/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java +++ b/java/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java @@ -53,12 +53,6 @@ final class PhoneNumberMatcher implements Iterator { * */ private static final Pattern PATTERN; - /** - * A phone number pattern that does not allow whitespace as punctuation. This pattern is only used - * in a second attempt to find a phone number occurring in the context of other numbers, such as - * when the preceding or following token is a zip code. - */ - private static final Pattern INNER; /** * Matches strings that look like publication pages. Example: *

Computing Complete Answers to Queries in the Presence of Limited Access Patterns.
@@ -75,9 +69,15 @@ final class PhoneNumberMatcher implements Iterator {
   private static final Pattern SLASH_SEPARATED_DATES =
       Pattern.compile("(?:(?:[0-3]?\\d/[01]?\\d)|(?:[01]?\\d/[0-3]?\\d))/(?:[12]\\d)?\\d{2}");
 
+  /**
+   * Matches white-space, which may indicate the end of a phone number and the start of something
+   * else (such as a neighbouring zip-code).
+   */
+  private static final Pattern GROUP_SEPARATOR = Pattern.compile("\\p{Z}+");
+
   static {
-    /* Builds the PATTERN and INNER regular expression patterns. The building blocks below
-     * exist to make the patterns more easily understood. */
+    /* Builds the PATTERN regular expression. The building blocks below exist to make the pattern
+     * more easily understood. */
 
     /* Limit on the number of leading (plus) characters. */
     String leadLimit = limit(0, 2);
@@ -92,10 +92,6 @@ final class PhoneNumberMatcher implements Iterator {
      * formats use spaces to separate each digit. */
     String blockLimit = limit(0, digitBlockLimit);
 
-    /* Same as {@link PhoneNumberUtil#VALID_PUNCTUATION} but without space characters. */
-    String nonSpacePunctuationChars = removeSpace(PhoneNumberUtil.VALID_PUNCTUATION);
-    /* A punctuation sequence without white space. */
-    String nonSpacePunctuation = "[" + nonSpacePunctuationChars + "]" + punctuationLimit;
     /* A punctuation sequence allowing white space. */
     String punctuation = "[" + PhoneNumberUtil.VALID_PUNCTUATION + "]" + punctuationLimit;
     /* A digits block without punctuation. */
@@ -109,12 +105,6 @@ final class PhoneNumberMatcher implements Iterator {
         digitSequence + "(?:" + punctuation + digitSequence + ")" + blockLimit +
         "(?:" + PhoneNumberUtil.KNOWN_EXTN_PATTERNS + ")?",
         PhoneNumberUtil.REGEX_FLAGS);
-
-    /* Phone number pattern with no whitespace allowed. */
-    INNER = Pattern.compile(
-        leadClass + leadLimit +
-        digitSequence + "(?:" + nonSpacePunctuation + digitSequence + ")" + blockLimit,
-        PhoneNumberUtil.REGEX_FLAGS);
   }
 
   /** Returns a regular expression quantifier with an upper and lower limit. */
@@ -125,23 +115,6 @@ final class PhoneNumberMatcher implements Iterator {
     return "{" + lower + "," + upper + "}";
   }
 
-  /**
-   * Returns a copy of {@code characters} with any {@linkplain Character#isSpaceChar space}
-   * characters removed.
-   */
-  private static String removeSpace(String characters) {
-    StringBuilder builder = new StringBuilder(characters.length());
-    int i = 0;
-    while (i < characters.length()) {
-      int codePoint = characters.codePointAt(i);
-      if (!Character.isSpaceChar(codePoint)) {
-        builder.appendCodePoint(codePoint);
-      }
-      i += Character.charCount(codePoint);
-    }
-    return builder.toString();
-  }
-
   /** The potential states of a PhoneNumberMatcher. */
   private enum State {
     NOT_READY, READY, DONE
@@ -287,28 +260,52 @@ final class PhoneNumberMatcher implements Iterator {
       return match;
     }
 
-    // If that failed, try to find an inner match without white space.
+    // If that failed, try to find an "inner match" - there might be a phone number within this
+    // candidate.
     return extractInnerMatch(rawString, offset);
   }
 
   /**
-   * Attempts to extract a match from {@code candidate} using the {@link #INNER} pattern.
+   * Attempts to extract a match from {@code candidate} if the whole candidate does not qualify as a
+   * match.
    *
    * @param candidate  the candidate text that might contain a phone number
-   * @param offset  the offset of {@code candidate} within {@link #text}
+   * @param offset  the current offset of {@code candidate} within {@link #text}
    * @return  the match found, null if none can be found
    */
   private PhoneNumberMatch extractInnerMatch(String candidate, int offset) {
-    int index = 0;
-    Matcher matcher = INNER.matcher(candidate);
-    while ((maxTries > 0) && matcher.find(index)) {
-      String innerCandidate = candidate.substring(matcher.start(), matcher.end());
-      PhoneNumberMatch match = parseAndVerify(innerCandidate, offset + matcher.start());
+    // Try removing either the first or last "group" in the number and see if this gives a result.
+    // We consider white space to be a possible indications of the start or end of the phone number.
+    Matcher groupMatcher = GROUP_SEPARATOR.matcher(candidate);
+
+    if (groupMatcher.find()) {
+      int groupStartIndex = groupMatcher.end();
+      // Remove the first group.
+      CharSequence withoutFirstGroup = candidate.substring(groupStartIndex);
+      withoutFirstGroup = trimAfterFirstMatch(PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN,
+                                              withoutFirstGroup);
+      PhoneNumberMatch match = parseAndVerify(withoutFirstGroup.toString(),
+                                              offset + groupStartIndex);
       if (match != null) {
         return match;
       }
       maxTries--;
-      index = matcher.end();
+
+      if (maxTries > 0) {
+        int lastGroupStart = groupStartIndex;
+        while (groupMatcher.find()) {
+          // Find the last group.
+          lastGroupStart = groupMatcher.start();
+        }
+        CharSequence withoutLastGroup = candidate.substring(0, lastGroupStart);
+        withoutLastGroup = trimAfterFirstMatch(PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN,
+                                               withoutLastGroup);
+        match = parseAndVerify(withoutLastGroup.toString(), offset);
+        if (match != null) {
+          return match;
+        }
+        maxTries--;
+      }
     }
     return null;
   }
diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
index 23c3446f8..db85d88b6 100644
--- a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
+++ b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
@@ -104,7 +104,8 @@ public class PhoneNumberUtil {
   private static final Map ALL_PLUS_NUMBER_GROUPING_SYMBOLS;
 
   static {
-    // Simple ASCII digits map used to populate DIGIT_MAPPINGS and ALPHA_MAPPINGS.
+    // Simple ASCII digits map used to populate DIGIT_MAPPINGS and
+    // ALL_PLUS_NUMBER_GROUPING_SYMBOLS.
     HashMap asciiDigitMappings = new HashMap();
     asciiDigitMappings.put('0', '0');
     asciiDigitMappings.put('1', '1');
@@ -263,7 +264,7 @@ public class PhoneNumberUtil {
   // are not alpha or numerical characters. The hash character is retained here, as it may signify
   // the previous block was an extension.
   private static final String UNWANTED_END_CHARS = "[[\\P{N}&&\\P{L}]&&[^#]]+$";
-  private static final Pattern UNWANTED_END_CHAR_PATTERN = Pattern.compile(UNWANTED_END_CHARS);
+  static final Pattern UNWANTED_END_CHAR_PATTERN = Pattern.compile(UNWANTED_END_CHARS);
 
   // We use this pattern to check if the phone number has at least three letters in it - if so, then
   // we treat it as a number where some phone-number digits are represented by letters.
@@ -466,13 +467,13 @@ public class PhoneNumberUtil {
 
   /**
    * Attempts to extract a possible number from the string passed in. This currently strips all
-   * leading characters that could not be used to start a phone number. Characters that can be used
-   * to start a phone number are defined in the VALID_START_CHAR_PATTERN. If none of these
-   * characters are found in the number passed in, an empty string is returned. This function also
-   * attempts to strip off any alternative extensions or endings if two or more are present, such as
-   * in the case of: (530) 583-6985 x302/x2303. The second extension here makes this actually two
-   * phone numbers, (530) 583-6985 x302 and (530) 583-6985 x2303. We remove the second extension so
-   * that the first number is parsed correctly.
+   * leading characters that cannot be used to start a phone number. Characters that can be used to
+   * start a phone number are defined in the VALID_START_CHAR_PATTERN. If none of these characters
+   * are found in the number passed in, an empty string is returned. This function also attempts to
+   * strip off any alternative extensions or endings if two or more are present, such as in the case
+   * of: (530) 583-6985 x302/x2303. The second extension here makes this actually two phone numbers,
+   * (530) 583-6985 x302 and (530) 583-6985 x2303. We remove the second extension so that the first
+   * number is parsed correctly.
    *
    * @param number  the string that might contain a phone number
    * @return        the number, stripped of any non-phone-number prefix (such as "Tel:") or an empty
@@ -960,7 +961,7 @@ public class PhoneNumberUtil {
   }
 
   /**
-   * Formats a phone number for out-of-country dialing purposes. If no countryCallingFrom is
+   * Formats a phone number for out-of-country dialing purposes. If no regionCallingFrom is
    * supplied, we format the number in its INTERNATIONAL format. If the country calling code is the
    * same as the region where the number is from, then NATIONAL formatting will be applied.
    *
@@ -1624,14 +1625,14 @@ public class PhoneNumberUtil {
    * significant number could contain a leading zero. An example of such a region is Italy. Returns
    * false if no metadata for the country is found.
    */
-   boolean isLeadingZeroPossible(int countryCallingCode) {
-     PhoneMetadata mainMetadataForCallingCode = getMetadataForRegion(
-         getRegionCodeForCountryCode(countryCallingCode));
-     if (mainMetadataForCallingCode == null) {
-       return false;
-     }
-     return mainMetadataForCallingCode.isLeadingZeroPossible();
-   }
+  boolean isLeadingZeroPossible(int countryCallingCode) {
+    PhoneMetadata mainMetadataForCallingCode = getMetadataForRegion(
+        getRegionCodeForCountryCode(countryCallingCode));
+    if (mainMetadataForCallingCode == null) {
+      return false;
+    }
+    return mainMetadataForCallingCode.isLeadingZeroPossible();
+  }
 
   /**
    * Checks if the number is a valid vanity (alpha) number such as 800 MICROSOFT. A valid vanity
@@ -1742,12 +1743,12 @@ public class PhoneNumberUtil {
    * @param number  the number that needs to be checked, in the form of a string
    * @param regionDialingFrom  the ISO 3166-1 two-letter region code that denotes the region that
    *     we are expecting the number to be dialed from.
-   *     Note this is different from the region where the number belongs. For example, the number
-   *     +1 650 253 0000 is a number that belongs to US. When written in this form, it could be
-   *     dialed from any region. When it is written as 00 1 650 253 0000, it could be dialed from
-   *     any region which uses an international dialling prefix of 00. When it is written as 650
-   *     253 0000, it could only be dialed from within the US, and when written as 253 0000, it
-   *     could only be dialed from within a smaller area in the US (Mountain View, CA, to be more
+   *     Note this is different from the region where the number belongs.  For example, the number
+   *     +1 650 253 0000 is a number that belongs to US. When written in this form, it can be
+   *     dialed from any region. When it is written as 00 1 650 253 0000, it can be dialed from any
+   *     region which uses an international dialling prefix of 00. When it is written as
+   *     650 253 0000, it can only be dialed from within the US, and when written as 253 0000, it
+   *     can only be dialed from within a smaller area in the US (Mountain View, CA, to be more
    *     specific).
    * @return  true if the number is possible
    */
@@ -1791,7 +1792,7 @@ public class PhoneNumberUtil {
    * @param regionCode  the ISO 3166-1 two-letter region code that denotes the region where
    *     the phone number is being entered
    *
-   * @return  an {@link com.google.i18n.phonenumbers.AsYouTypeFormatter} object, which could be used
+   * @return  an {@link com.google.i18n.phonenumbers.AsYouTypeFormatter} object, which can be used
    *     to format phone numbers in the specific region "as you type"
    */
   public AsYouTypeFormatter getAsYouTypeFormatter(String regionCode) {
@@ -1898,8 +1899,8 @@ public class PhoneNumberUtil {
         Pattern possibleNumberPattern =
             regexCache.getPatternForRegex(generalDesc.getPossibleNumberPattern());
         // If the number was not valid before but is valid now, or if it was too long before, we
-        // consider the number with the country code stripped to be a better result and keep that
-        // instead.
+        // consider the number with the country calling code stripped to be a better result and
+        // keep that instead.
         if ((!validNumberPattern.matcher(fullNumber).matches() &&
              validNumberPattern.matcher(potentialNationalNumber).matches()) ||
              testNumberLengthAgainstPattern(possibleNumberPattern, fullNumber.toString())
@@ -1950,8 +1951,8 @@ public class PhoneNumberUtil {
    * @param possibleIddPrefix  the international direct dialing prefix from the region we
    *     think this number may be dialed in
    * @return  the corresponding CountryCodeSource if an international dialing prefix could be
-   *          removed from the number, otherwise CountryCodeSource.FROM_DEFAULT_COUNTRY if the
-   *          number did not seem to be in international format.
+   *     removed from the number, otherwise CountryCodeSource.FROM_DEFAULT_COUNTRY if the number did
+   *     not seem to be in international format.
    */
   CountryCodeSource maybeStripInternationalPrefixAndNormalize(
       StringBuffer number,
@@ -2371,7 +2372,7 @@ public class PhoneNumberUtil {
    * @param firstNumber  first number to compare. Can contain formatting, and can have country
    *     calling code specified with + at the start.
    * @param secondNumber  second number to compare. Can contain formatting, and can have country
-   *     code specified with + at the start.
+   *     calling code specified with + at the start.
    * @return  NOT_A_NUMBER, NO_MATCH, SHORT_NSN_MATCH, NSN_MATCH, EXACT_MATCH. See
    *     isNumberMatch(PhoneNumber firstNumber, PhoneNumber secondNumber) for more details.
    */
@@ -2409,7 +2410,7 @@ public class PhoneNumberUtil {
    *
    * @param firstNumber  first number to compare in proto buffer format.
    * @param secondNumber  second number to compare. Can contain formatting, and can have country
-   *     code specified with + at the start.
+   *     calling code specified with + at the start.
    * @return  NOT_A_NUMBER, NO_MATCH, SHORT_NSN_MATCH, NSN_MATCH, EXACT_MATCH. See
    *     isNumberMatch(PhoneNumber firstNumber, PhoneNumber secondNumber) for more details.
    */
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM
index 45ee014f4..62af85dac 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_AZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ
index 4b3d33104..05813012e 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF
index a450f514c..63d7e642f 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW
index acbe7e113..641043db9 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BW differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ
index d1d270b4d..3e4f37164 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BZ differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI
index 15a95d639..dadad8e72 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR
index 942b64668..08a1ab0ea 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_FJ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FJ
index 616f4c6d1..443c7c935 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_FM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FM
index f58dc40d2..678e85d99 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FM differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB
index b1ffcc9d3..843c00c40 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP
index 2c21e7428..fdce95280 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GP differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY
index e6666f997..1636ed429 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GY differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK
index 260696ba9..89a9cff10 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM
index bff2a7b67..23edbe712 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JM differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH
index f34f0eb1e..3b43e3946 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB
index c6b6e14ba..faf8a72f2 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY
index 0873564e7..a3c600057 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LY differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV
index cef8e087f..7e2e0b3a7 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MV differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF
index ab7927480..59991ff41 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NF differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI
index 437f7d196..95e956a84 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NI differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR
index c09d24677..65dd064a1 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NR differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE
index 6f97174c4..c0c26bf39 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK
index 1c37c1c41..6b0027d56 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PK differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ
index bca54b0c3..b487a132f 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SZ differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ
index 079698424..a49e8a882 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TJ differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV
index 792d2973f..973582a01 100644
Binary files a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV and b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TV differ
diff --git a/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US b/java/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US
index 2ee936c90..e0f78752e 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/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java b/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java
index 6a48dcca7..da8e8cc4b 100644
--- a/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java
+++ b/java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java
@@ -343,7 +343,7 @@ public class AsYouTypeFormatterTest extends TestCase {
   }
 
   public void testAYTFGBTollFree() {
-     AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("gb");
+    AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("gb");
     assertEquals("0", formatter.inputDigit('0'));
     assertEquals("08", formatter.inputDigit('8'));
     assertEquals("080", formatter.inputDigit('0'));
diff --git a/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java b/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java
index 8153694d3..37d70fe71 100644
--- a/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java
+++ b/java/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java
@@ -198,6 +198,30 @@ public class PhoneNumberMatcherTest extends TestCase {
     }
   }
 
+  public void testMatchWithSurroundingZipcodes() throws Exception {
+    String number = "415-666-7777";
+    String zipPreceding = "My address is CA 34215. " + number + " is my number.";
+    PhoneNumber expectedResult = phoneUtil.parse(number, "US");
+
+    Iterator iterator = phoneUtil.findNumbers(zipPreceding, "US").iterator();
+    PhoneNumberMatch match = iterator.hasNext() ? iterator.next() : null;
+    assertNotNull("Did not find a number in '" + zipPreceding + "'; expected " + number, match);
+    assertEquals(expectedResult, match.number());
+    assertEquals(number, match.rawString());
+
+    // Now repeat, but this time the phone number has spaces in it. It should still be found.
+    number = "(415) 666 7777";
+
+    String zipFollowing = "My number is " + number + ". 34215 is my zip-code.";
+    iterator = phoneUtil.findNumbers(zipFollowing, "US").iterator();
+
+    PhoneNumberMatch matchWithSpaces = iterator.hasNext() ? iterator.next() : null;
+    assertNotNull("Did not find a number in '" + zipFollowing + "'; expected " + number,
+                  matchWithSpaces);
+    assertEquals(expectedResult, matchWithSpaces.number());
+    assertEquals(number, matchWithSpaces.rawString());
+  }
+
   public void testNoMatchIfRegionIsNull() throws Exception {
     // Fail on non-international prefix if region code is null.
     assertTrue(hasNoMatches(phoneUtil.findNumbers(
@@ -417,7 +441,7 @@ public class PhoneNumberMatcherTest extends TestCase {
   }
 
   /**
-   * Tests numbers found by {@link PhoneNumberUtil#find(CharSequence, String)} in various
+   * Tests numbers found by {@link PhoneNumberUtil#findNumbers(CharSequence, String)} in various
    * textual contexts.
    *
    * @param number the number to test and the corresponding region code to use
diff --git a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
index 82aeb218e..e485b1e8e 100644
--- a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
+++ b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
@@ -372,6 +372,7 @@ public class PhoneNumberUtilTest extends TestCase {
     assertEquals("1234", phoneUtil.format(DE_SHORT_NUMBER, PhoneNumberFormat.NATIONAL));
     assertEquals("+49 1234", phoneUtil.format(DE_SHORT_NUMBER, PhoneNumberFormat.INTERNATIONAL));
 
+    deNumber.clear();
     deNumber.setCountryCode(49).setNationalNumber(41341234);
     assertEquals("04134 1234", phoneUtil.format(deNumber, PhoneNumberFormat.NATIONAL));
   }
@@ -719,12 +720,11 @@ public class PhoneNumberUtilTest extends TestCase {
     assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE, phoneUtil.getNumberType(BS_MOBILE));
     assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE, phoneUtil.getNumberType(GB_MOBILE));
     assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE, phoneUtil.getNumberType(IT_MOBILE));
+    assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE, phoneUtil.getNumberType(AR_MOBILE));
 
     PhoneNumber mobileNumber = new PhoneNumber();
     mobileNumber.setCountryCode(49).setNationalNumber(15123456789L);
     assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE, phoneUtil.getNumberType(mobileNumber));
-
-    assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE, phoneUtil.getNumberType(AR_MOBILE));
   }
 
   public void testIsFixedLine() {
@@ -913,8 +913,8 @@ public class PhoneNumberUtilTest extends TestCase {
     assertEquals(PhoneNumberUtil.ValidationResult.TOO_SHORT,
                  phoneUtil.isPossibleNumberWithReason(number));
 
-    number.setCountryCode(65);
-    number.setNationalNumber(1234567890L);
+    number.clear();
+    number.setCountryCode(65).setNationalNumber(1234567890L);
     assertEquals(PhoneNumberUtil.ValidationResult.IS_POSSIBLE,
                  phoneUtil.isPossibleNumberWithReason(number));
 
diff --git a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP
index 82581ad6d..f1c9af567 100644
Binary files a/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP and b/java/test/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_JP differ
diff --git a/resources/PhoneNumberMetaData.xml b/resources/PhoneNumberMetaData.xml
index a40c53938..748ce21c6 100644
--- a/resources/PhoneNumberMetaData.xml
+++ b/resources/PhoneNumberMetaData.xml
@@ -514,10 +514,15 @@
         
           
             [17]|
-            9[1-469]
+            9[1-9]
           
           $1 $2
         
+        
+          6
+          $1 $2
+        
         
           [23]
           $1 $2
@@ -532,7 +537,7 @@
         
       
       
-        [1-37-9]\d{7}
+        [1-36-9]\d{7}
         \d{5,8}
       
       
@@ -556,7 +561,7 @@
         
           (?:
             77|
-            9[1-469]
+            9[1-46-9]
           )\d{6}
         
         \d{8}
@@ -577,6 +582,12 @@
         \d{8}
         80112345
       
+      
+        
+        6027\d{4}
+        \d{8}
+        60271234
+      
       
         
           8[1-7]\d{2}|
@@ -1359,9 +1370,14 @@
           [4-8]
           $1 $2 $3 $4
         
+        
+          9
+          $1 $2 $3 $4
+        
       
       
-        [1-8]\d{7,8}
+        [1-9]\d{7,8}
         \d{5,9}
       
       
@@ -1410,10 +1426,18 @@
         401234567
       
       
+        
         88\d{7}
         \d{9}
         881234567
       
+      
+        
+        900200\d{3}
+        \d{9}
+        900200123
+      
     
 
     
@@ -1849,12 +1873,13 @@
       
       
         
+             since diallable numbers have been found outside the range that the document specifies.
+             Including 716 as well since many numbers seem to have this prefix. -->
         
           7(?:
             [024-6]\d|
-            1[0-489]|
-            3[0124]|
+            1[0-4689]|
+            3[0-6]|
             7[01]|
             8[013-9]|
             9[0-4]
@@ -2549,10 +2574,14 @@
     
 
     
-    
+    
     
       
-        
+        
+          [2-6]
+          $1 $2
+        
+        
           7
           $1 $2 $3
         
@@ -2562,7 +2591,7 @@
         
       
       
-        [2-9]\d{6,7}
+        [2-79]\d{6,7}
         \d{7,8}
       
       
@@ -2605,23 +2634,26 @@
       
         
           7(?:
-            [1-3]\d{6}|
-            4[0-7]\d{5}
+            [1-35]\d{6}|
+            [46][0-7]\d{5}
           )
         
         \d{8}
         71123456
       
-      
-        8\d{6}
-        \d{7}
-        8123456
-      
+      
       
         90\d{5}
         \d{7}
         9012345
       
+      
+        79[12][01]\d{4}
+        \d{8}
+        79101234
+      
     
 
     
@@ -2745,11 +2777,12 @@
         2221234
       
       
+        
         
           6(?:
-            [01]\d|
-            2[0-5]|
-            [67][01])\d{4}
+            [0-2]\d|
+            [67][01]
+          )\d{4}
         
         \d{7}
         6221234
@@ -3087,13 +3120,13 @@
         21234567
       
       
-        
+        
         
           (?:
             0[1-9]|
             4[04-9]|
-            50|
+            5[07]|
             6[067]
           )\d{6}
         
@@ -3854,7 +3887,7 @@
         
           
             [24]|
-            8[389]
+            8[3-9]
           
           $1 $2
         
@@ -3873,7 +3906,14 @@
         22123456
       
       
-        8[389]\d{6}
+        
+        
+          8(?:
+            [389]\d|
+            7[0-3]
+          )\d{5}
+          
         \d{8}
         83123456
       
@@ -5233,7 +5273,79 @@
     
 
     
-    
+    
+    
+    
+      
+        
+          [36-9]
+          $1 $2
+        
+        
+          0
+          $1 $2 $3
+        
+      
+      
+        
+          [36-9]\d{6}|
+          0\d{10}
+        
+        \d{7}(?:\d{4})?
+      
+      
+        
+        
+          (?:
+            3[0-5]|
+            6[25-7]|
+            8[58]
+          )\d{5}
+        
+        \d{7}
+        3212345
+      
+      
+        
+          (?:
+            7[0-4]|
+            9[29]
+          )\d{5}
+        
+        \d{7}
+        7012345
+      
+      
+        
+        0800\d{7}
+        \d{11}
+        08001234567
+      
+      
+        
+        
+          0(?:
+           04|
+           1[34]|
+           8[1-4]
+          )|
+          1(?:
+            0[1-3]|
+            [25]9
+          )|
+          2[289]|
+          30|
+          [45]4|
+          75|
+          91[137]
+        
+        \d{2,3}
+        22
+      
     
 
     
@@ -5263,7 +5375,33 @@
     
 
     
+    
     
+      
+        
+          $1 $2
+        
+      
+      
+        [39]\d{6}
+        \d{7}
+      
+      
+        
+            3[2357]0[1-9]\d{3}|
+            9[2-6]\d{5}
+        
+        3201234
+      
+      
+        
+        
+          3[2357]0[1-9]\d{3}|
+          9[2-7]\d{5}
+        
+        3501234
+      
     
 
     
@@ -5942,7 +6080,7 @@
             9(?:
               [04-9]\d|
               1[02-9]|
-              2[0135-9]|
+              2[0-35-9]|
               3[0-689]
             )
           )\d{6}
@@ -6665,9 +6803,14 @@
         590201234
       
       
+        
         
           690(?:
             00|
+            1[1-9]|
+            2[013-5]|
             [3-5]\d|
             6[0-57-9]|
             7[1-6]|
@@ -7081,8 +7224,78 @@
     
 
     
-    
+    
+    
+      
+        
+          $1 $2
+        
+      
+      
+        [2-4679]\d{6}
+        \d{7}
+      
+      
+        
+          (?:
+            2(?:
+              1[6-9]|
+              2[0-35-9]|
+              3[1-4]|
+              5[3-9]|
+              6\d|
+              7[0-24-79]
+            )|
+            3(?:
+              2[25-9]|
+              3\d
+            )|
+            4(?:
+              4[0-24]|
+              5[56]
+            )|
+            77[1-57]
+          )\d{4}
+        
+        2201234
+      
+      
+        
+        6\d{6}
+        6091234
+      
+      
+        
+          (?:
+            289|
+            862
+          )\d{4}
+        
+        2891234
+      
+      
+        9008\d{3}
+        9008123
+      
+      
+        
+          0(?:
+            02|
+            171|
+            444|
+            7[67]7|
+            801|
+            9(?:
+              0[78]|
+              [2-47]
+            )
+          )
+       
+       \d{3,4}
+       0801
+      
     
 
     
@@ -7141,6 +7354,7 @@
       
         8[1-3]\d{6}
         \d{8}
+        81123456
       
     
 
@@ -9116,19 +9330,19 @@
           876(?:
             (?:
               5[0-26]|
-              6\d|
-              7[1-6]|
-              9[2-8]
+              6\d
             )\d{5}|
             (?:
               7(?:
                 0[2-689]|
+                [1-6]\d|
                 8[056]|
                 9[45]
               )|
               9(?:
                 0[1-8]|
                 1[02378]|
+                [2-8]\d|
                 9[2-468]
               )
             )\d{4}
@@ -9137,18 +9351,18 @@
         8765123456
       
       
-        
+        
         
           876(?:
             (?:
-              21|
+              2[178]|
               [348]\d|
-              5[78]|
-              77
+              5[78]
             )\d|
             7(?:
               0[07]|
+              7\d|
               8[1-47-9]|
               9[0-36-9]
             )|
@@ -10341,15 +10555,18 @@
         23456789
       
       
-        
+        
         
           (?:
             (?:
               1[0-35-9]|
               9[1-49]
             )[1-9]|
-            85[2-689]
+            8(?:
+              0[89]|
+              5[2-689]
+            )
           )\d{5}
         
         \d{8}
@@ -11145,7 +11362,7 @@
             [89][01]|
             7(?:
               [01]|
-              66)
+              6[67])
           
           $1 $2 $3
         
@@ -11173,7 +11390,7 @@
             3\d|
             7(?:
               [01]\d|
-              66
+              6[67]
             )
           )\d{5}
         
@@ -11181,14 +11398,14 @@
         71123456
       
       
-        8[01]\d{6}
+        9[01]\d{6}
         \d{8}
-        80123456
+        90123456
       
       
-        9[01]\d{6}
+        8[01]\d{6}
         \d{8}
-        90123456
+        80123456
       
     
 
@@ -11838,7 +12055,9 @@
         212345678
       
       
-        9[12356]\d{7}
+        
+        9[1-6]\d{7}
         \d{9}
         912345678
       
@@ -13011,9 +13230,10 @@
         6701234
       
       
+        
         
           (?:
-            7[36-9]|
+            7[3-9]|
             9[6-9]
           )\d{5}
         
@@ -13712,7 +13932,43 @@
     
 
     
+    
+    
     
+      
+        
+           1
+          $1 $2
+        
+        
+          3
+          $1 $2
+        
+      
+      
+        [13]\d{5}
+        \d{5,6}
+      
+      
+        
+        
+          (?:
+            1(?:
+              06|
+              17|
+              28|
+              39
+            )|
+            3[012]\d
+          )\d{3}
+        
+        106609
+      
+      
+        38\d{4}
+        381234
+      
     
 
     
@@ -13818,8 +14074,29 @@
     
 
     
-    
+    
+    
+      
+        
+          $1 $2
+        
+      
+      
+        [128]\d{7}
+        \d{8}
+      
+      
+        2\d{7}
+        21234567
+      
+      
+        8\d{7}
+        81234567
+      
+      
+        1800\d{4}
+        18001234
+      
     
 
     
@@ -14047,8 +14324,41 @@
     
 
     
-    
+    
+    
+      
+        
+          $1 $2
+        
+      
+      
+        [458]\d{6}
+        \d{7}
+      
+      
+        
+          (?:
+            444|
+            888
+          )\d{4}
+        
+        4441234
+      
+      
+        55[5-9]\d{4}
+        5551234
+      
+      
+        
+          1(?:
+            1[012]|
+            23|
+            92
+          )
+        
+        \d{3}
+        110
+      
     
 
     
@@ -14239,7 +14549,7 @@
     
     
     
-    
       
@@ -14727,13 +15037,15 @@
         2123456789
       
       
+        
         
           3(?:
             0\d|
             1[2-5]|
             2[1-3]|
             3[1-6]|
-            4[2-6]|
+            4[2-7]|
             64
           )\d{7}
         
@@ -16620,22 +16932,16 @@
 
     
     
-    
     
       
-        
-          [2-6]
-          $1 $2
-        
         
           [027]
           $1 $2
         
       
       
-        [02-7]\d{6,7}
-        \d{7,8}
+        [027]\d{7}
+        \d{8}
       
       
         0800\d{4}
@@ -16643,10 +16949,8 @@
         08001234
       
       
-        
         
-          2?(?:
+          2(?:
             2(?:
               0[07]|
               [13]7|
@@ -16660,10 +16964,6 @@
             )|
             (?:
               40[4-69]|
-              16|
-              2[12]|
-              3[57]|
-              [4578]2|
               67
             )|
             5(?:
@@ -16675,20 +16975,14 @@
             )
           )\d{4}
         
-        2171234
+        22171234
       
       
-        
-          (?:
-            6|
-            7[6-8]
-          )\d{6}
-        
+        7[6-8]\d{6}
         76123456
       
       
         0800\d{4}
-        \d{8}
         08001234
       
     
@@ -16931,7 +17225,7 @@
     
     
     
+               nationalPrefix="8" nationalPrefixFormattingRule="($NP) $FG">
       
         
           
@@ -16940,9 +17234,10 @@
           
           $1 $2 $3
         
-        
+        
           
             4[48]|
+            5|
             9(?:
               19|
               [0235-9]
@@ -16972,7 +17267,7 @@
         
       
       
-        [349]\d{8}
+        [3-59]\d{8}
         \d{3,9}
       
       
@@ -16981,7 +17276,7 @@
             3(?:
               1[3-5]|
               2[245]|
-              31|
+              3[12]|
               4[24-7]|
               5[25]|
               72
@@ -16998,7 +17293,12 @@
       
         
-        9[0-35-9]\d{7}
+        
+          (?:
+            505|
+            9[0-35-9]\d
+          )\d{6}
+        
         \d{9}
         917123456
       
@@ -17307,7 +17607,26 @@
     
 
     
+    
     
+      
+      
+        [29]\d{4,5}
+        \d{5,6}
+      
+      
+        2[02-9]\d{3}
+        \d{5}
+        20123
+      
+      
+        
+        90\d{4}
+        \d{6}
+        901234
+      
     
 
     
@@ -17741,7 +18060,7 @@
               0[1-57-9]|
               1[0235-8]|
               20|
-              3[014]|
+              3[0149]|
               4[01]|
               5[19]|
               6[1-37]|
@@ -17783,7 +18102,7 @@
             9(?:
               0[1346-9]|
               1[02-9]|
-              2[058]|
+              2[0589]|
               3[1678]|
               4[0179]|
               5[1246]|
@@ -17833,7 +18152,7 @@
               0[1-57-9]|
               1[0235-8]|
               20|
-              3[014]|
+              3[0149]|
               4[01]|
               5[19]|
               6[1-37]|
@@ -17875,7 +18194,7 @@
             9(?:
               0[1346-9]|
               1[02-9]|
-              2[058]|
+              2[0589]|
               3[1678]|
               4[0179]|
               5[1246]|
diff --git a/resources/PhoneNumberMetaDataForTesting.xml b/resources/PhoneNumberMetaDataForTesting.xml
index 0293daeac..661bdd2b4 100644
--- a/resources/PhoneNumberMetaDataForTesting.xml
+++ b/resources/PhoneNumberMetaDataForTesting.xml
@@ -365,6 +365,12 @@
           [23]
           $1 $2 $3
         
+        
+        
+          [23]
+          *$1
+