Skip to content

Commit

Permalink
Update the validation patterns (GH-59)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtyomVancyan authored Nov 3, 2024
2 parents 6ecbb03 + b8b9142 commit 9ad4bfb
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 50 deletions.
114 changes: 68 additions & 46 deletions resources/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8087,6 +8087,10 @@
nationalPrefix="0" nationalPrefixForParsing="0([3579]|4(?:[14]4|56))?"
mobileNumberPortableRegion="true">
<availableFormats>
<numberFormat pattern="(\d{4})(\d{4})">
<leadingDigits>46</leadingDigits>
<format>$1 $2</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{7})" nationalPrefixFormattingRule="($FG)"
carrierCodeFormattingRule="$NP$CC $FG">
<leadingDigits>
Expand All @@ -8110,15 +8114,18 @@
</availableFormats>
<generalDesc>
<nationalNumberPattern>
60\d{8}|
(?:
46|
60\d\d
)\d{6}|
(?:
1\d|
[39]
)\d{9}
</nationalNumberPattern>
</generalDesc>
<fixedLine>
<possibleLengths national="10" localOnly="7"/>
<possibleLengths national="8,10" localOnly="4,7"/>
<exampleNumber>6012345678</exampleNumber>
<nationalNumberPattern>
601055(?:
Expand All @@ -8129,9 +8136,12 @@
[0-4]\d|
5[0-4]
)\d{4}|
60(?:
[124-7][2-9]|
8[1-9]
(?:
46|
60(?:
[124-7][2-9]|
8[1-9]
)
)\d{6}
</nationalNumberPattern>
</fixedLine>
Expand Down Expand Up @@ -9974,7 +9984,7 @@
)|
(?:
1(?:
0[236]|
0[2-6]|
1\d
)|
(?:
Expand All @@ -9996,7 +10006,7 @@
)|
(?:
(?:
[124-6]\d|
[124-69]\d|
3[5-9]
)\d|
7(?:
Expand Down Expand Up @@ -20451,7 +20461,7 @@
6[279]|
7[356]|
8[268]|
9[245]
9[2457]
)\d{5}
</nationalNumberPattern>
</fixedLine>
Expand Down Expand Up @@ -21484,7 +21494,13 @@
mobileNumberPortableRegion="true">
<availableFormats>
<numberFormat pattern="(\d{3})(\d{2})(\d{2})(\d{2})" nationalPrefixFormattingRule="$NP$FG">
<leadingDigits>[569]</leadingDigits>
<leadingDigits>
[569]|
8(?:
0[6-9]|
[36]
)
</leadingDigits>
<format>$1 $2 $3 $4</format>
</numberFormat>
<numberFormat pattern="(\d{3})(\d{2})(\d{2})(\d{2})" nationalPrefixFormattingRule="$NP$FG">
Expand All @@ -21497,21 +21513,27 @@
596\d{6}|
(?:
69|
80|
9\d
[89]\d
)\d{7}
</nationalNumberPattern>
</generalDesc>
<fixedLine>
<possibleLengths national="9"/>
<exampleNumber>596301234</exampleNumber>
<nationalNumberPattern>
596(?:
[03-7]\d|
1[05]|
2[7-9]|
8[0-39]|
9[04-9]
(?:
596(?:
[03-7]\d|
1[05]|
2[7-9]|
8[0-39]|
9[04-9]
)|
80[6-9]\d\d|
9(?:
477[6-9]|
767[4589]
)
)\d{4}
</nationalNumberPattern>
</fixedLine>
Expand All @@ -21520,15 +21542,7 @@
<mobile>
<possibleLengths national="9"/>
<exampleNumber>696201234</exampleNumber>
<nationalNumberPattern>
69(?:
6(?:
[0-46-9]\d|
5[0-6]
)|
727
)\d{4}
</nationalNumberPattern>
<nationalNumberPattern>69[67]\d{6}</nationalNumberPattern>
</mobile>
<!-- As per ARCEP, mainland France and overseas territories use 0800 to 0805 as Toll-free
numbers. -->
Expand All @@ -21537,6 +21551,11 @@
<exampleNumber>800012345</exampleNumber>
<nationalNumberPattern>80[0-5]\d{6}</nationalNumberPattern>
</tollFree>
<premiumRate>
<possibleLengths national="9"/>
<exampleNumber>810123456</exampleNumber>
<nationalNumberPattern>8[129]\d{7}</nationalNumberPattern>
</premiumRate>
<voip>
<possibleLengths national="9"/>
<exampleNumber>976612345</exampleNumber>
Expand Down Expand Up @@ -21952,7 +21971,7 @@
<nationalNumberPattern>
(?:
3(?:
0[0-3]|
0[0-4]|
3[0-59]
)|
6(?:
Expand Down Expand Up @@ -24854,7 +24873,7 @@
[45]\d{5}|
(?:
708|
80\d
8\d\d
)\d{6}
</nationalNumberPattern>
</generalDesc>
Expand All @@ -24864,12 +24883,13 @@
ranges are added to both fixed-line and mobile categories as it is not clear in ITU
doc. -->
<fixedLine>
<possibleLengths national="6"/>
<possibleLengths national="6,9"/>
<exampleNumber>430123</exampleNumber>
<nationalNumberPattern>
(?:
4[1-35-7]|
5[01]
4[1-35-9]|
5[0-47-9]|
80[6-9]\d\d
)\d{4}
</nationalNumberPattern>
</fixedLine>
Expand All @@ -24880,8 +24900,8 @@
<exampleNumber>551234</exampleNumber>
<nationalNumberPattern>
(?:
4[02-4]|
5[056]|
4[02-489]|
5[02-9]|
708[45][0-5]
)\d{4}
</nationalNumberPattern>
Expand All @@ -24893,6 +24913,11 @@
<exampleNumber>800012345</exampleNumber>
<nationalNumberPattern>80[0-5]\d{6}</nationalNumberPattern>
</tollFree>
<premiumRate>
<possibleLengths national="9"/>
<exampleNumber>810123456</exampleNumber>
<nationalNumberPattern>8[129]\d{7}</nationalNumberPattern>
</premiumRate>
</territory>

<!-- Puerto Rico (PR) -->
Expand Down Expand Up @@ -26751,21 +26776,18 @@
<possibleLengths national="8"/>
<exampleNumber>81234567</exampleNumber>
<nationalNumberPattern>
8(?:
09[0-689]|
96[0-2]
)\d{4}|
(?:
8(?:
0(?:
[1-8]\d|
9[0-689]
)|
[1-8]\d\d|
9(?:
[0-4]\d|
5[0-3]|
6[0-2]
)
0[1-8]|
[1-8]\d|
9[0-5]
)|
9[0-8]\d\d
)\d{4}
9[0-8]\d
)\d{5}
</nationalNumberPattern>
</mobile>
<tollFree>
Expand Down Expand Up @@ -28318,7 +28340,7 @@
)\d{6}|
(?:
[09]\d|
1[017]|
1[0178]|
2[02]|
[34]0|
5[05]|
Expand Down
8 changes: 4 additions & 4 deletions src/metadata/validations.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@
"^(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}$"
],
"co": [
"^\\d{10,11}$",
"^60\\d{8}|(?:1\\d|[39])\\d{9}$"
"^\\d{8,11}$",
"^(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}$"
],
"cr": [
"^\\d{8,10}$",
Expand Down Expand Up @@ -549,7 +549,7 @@
],
"mq": [
"^\\d{9}$",
"^596\\d{6}|(?:69|80|9\\d)\\d{7}$"
"^596\\d{6}|(?:69|[89]\\d)\\d{7}$"
],
"mr": [
"^\\d{8}$",
Expand Down Expand Up @@ -669,7 +669,7 @@
],
"pm": [
"^\\d{6,9}$",
"^[45]\\d{5}|(?:708|80\\d)\\d{6}$"
"^[45]\\d{5}|(?:708|8\\d\\d)\\d{6}$"
],
"pr": [
"^\\d{10}$",
Expand Down

0 comments on commit 9ad4bfb

Please sign in to comment.