Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save justincampbell/1051887 to your computer and use it in GitHub Desktop.
Save justincampbell/1051887 to your computer and use it in GitHub Desktop.
<!-- Copyright (C) 2009 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@author: Shaopeng Jia
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
../resources/PhoneNumberMetaData.xml
-->
<phoneNumberMetadata>
<territories>
<!-- Mexico -->
<territory id="MX" countryCode="52" internationalPrefix="00"
nationalPrefix="01" nationalPrefixForParsing="01|04[45](\d{10})"
nationalPrefixTransformRule="1$1" nationalPrefixFormattingRule="$NP $FG">
<availableFormats>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>[89]00</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{2})(\d{4})(\d{4})">
<leadingDigits>33|55|81</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<leadingDigits>[2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9]</leadingDigits>
<format>$1 $2 $3</format>
</numberFormat>
<numberFormat nationalPrefixFormattingRule="$FG" pattern="(1)(\d{2})(\d{4})(\d{4})">
<leadingDigits>1(?:33|55|81)</leadingDigits>
<format>045 $2 $3 $4</format>
<intlFormat>$1 $2 $3 $4</intlFormat>
</numberFormat>
<numberFormat nationalPrefixFormattingRule="$FG" pattern="(1)(\d{3})(\d{3})(\d{4})">
<leadingDigits>1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9])</leadingDigits>
<format>045 $2 $3 $4</format>
<intlFormat>$1 $2 $3 $4</intlFormat>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[1-9]\d{9,10}</nationalNumberPattern>
<possibleNumberPattern>\d{7,11}</possibleNumberPattern>
</generalDesc>
<fixedLine>
<nationalNumberPattern>[2-9]\d{9}</nationalNumberPattern>
<possibleNumberPattern>\d{7,10}</possibleNumberPattern>
</fixedLine>
<mobile>
<nationalNumberPattern>1\d{10}</nationalNumberPattern>
<possibleNumberPattern>\d{11}</possibleNumberPattern>
</mobile>
<tollFree>
<nationalNumberPattern>800\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
</tollFree>
<premiumRate>
<nationalNumberPattern>900\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
</premiumRate>
</territory>
<!-- United States -->
<!-- http://www.nanpa.com/reports/reports_npa.html -->
<!-- For testing purposes, numbers starting with 24 are not considered US
numbers.-->
<territory id="US" countryCode="1" internationalPrefix="011"
preferredExtnPrefix=" extn. " nationalPrefix="1"
mainCountryForCode="true" >
<availableFormats>
<numberFormat pattern="(\d{3})(\d{4})">
<format>$1 $2</format>
<intlFormat>NA</intlFormat>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{3})(\d{4})">
<format>$1 $2 $3</format>
</numberFormat>
</availableFormats>
<generalDesc>
<nationalNumberPattern>[13-9]\d{9}|2[0-35-9]\d{8}</nationalNumberPattern>
<possibleNumberPattern>\d{7}(?:\d{3})?</possibleNumberPattern>
<exampleNumber>1234567890</exampleNumber>
</generalDesc>
<noInternationalDialling>
<!-- This range is added for testing purposes only. -->
<nationalNumberPattern>800\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
</noInternationalDialling>
<tollFree>
<nationalNumberPattern>8(?:00|66|77|88)\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
</tollFree>
<premiumRate>
<nationalNumberPattern>900\d{7}</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
</premiumRate>
</territory>
</territories>
</phoneNumberMetadata>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment