Skip to content

Commit

Permalink
Added missing countries
Browse files Browse the repository at this point in the history
  • Loading branch information
mnestorov authored Aug 21, 2024
1 parent 5495b95 commit 1eb0896
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions patterns.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,30 @@
"[0-9]{1,14}$": "Matches 1 to 14 digits following the initial digit, representing the local phone number."
}
},
"Greece": {
"pattern": "^\\+30[2-9][0-9]{9}$",
"explanation": {
"^\\+30": "Matches the country code for Greece (+30).",
"[2-9]": "Ensures that the first digit after the country code is between 2 and 9.",
"[0-9]{9}$": "Matches exactly 9 digits following the initial digit, representing the local phone number."
}
},
"Hungary": {
"pattern": "^\\+36[1-9][0-9]{8}$",
"explanation": {
"^\\+36": "Matches the country code for Hungary (+36).",
"[1-9]": "Ensures that the first digit after the country code is between 1 and 9.",
"[0-9]{8}$": "Matches exactly 8 digits following the initial digit, representing the local phone number."
}
},
"Ireland": {
"pattern": "^\\+353[1-9][0-9]{6,9}$",
"explanation": {
"^\\+353": "Matches the country code for Ireland (+353).",
"[1-9]": "Ensures that the first digit after the country code is between 1 and 9.",
"[0-9]{6,9}$": "Matches between 6 and 9 digits following the initial digit, representing the local phone number."
}
},
"Italy": {
"pattern": "^\\+39[0-9]{6,12}$",
"explanation": {
Expand Down Expand Up @@ -354,6 +378,30 @@
"^\\d{5}$": "Matches exactly 5 digits, representing the postal code."
}
},
"Greece": {
"pattern": "^\\d{3}\\s?\\d{2}$",
"explanation": {
"^\\d{3}":"Matches the first 3 digits of the postal code.",
"\\s?": "Optionally matches a space.",
"\\d{2}$": "Matches the final 2 digits of the postal code."
}
},
"Hungary": {
"pattern": "^\\d{4}$",
"explanation": {
"^\\d{4}$": "Matches 4 digits, representing the postal code."
}
},
"Ireland": {
"pattern": "^(D6W|[A-Z]{1}[0-9]{1,2}|[A-Z]{2}[0-9]{1,2}|[A-Z]{1}[0-9]{1}[A-Z]{1}|[A-Z]{2}[0-9]{1}[A-Z]{1})$",
"explanation": {
"^D6W": "Matches the specific postal district 'D6W' in Dublin.",
"[A-Z]{1}[0-9]{1,2}": "Matches a single letter followed by 1 or 2 digits (e.g., A1 or B12).",
"[A-Z]{2}[0-9]{1,2}": "Matches two letters followed by 1 or 2 digits (e.g., AB1 or CD12).",
"[A-Z]{1}[0-9]{1}[A-Z]{1}": "Matches a single letter, followed by a digit and another letter (e.g., A1B).",
"[A-Z]{2}[0-9]{1}[A-Z]{1}": "Matches two letters, followed by a digit and another letter (e.g., AB1C)."
}
},
"Italy": {
"pattern": "^\\d{5}$",
"explanation": {
Expand Down Expand Up @@ -588,6 +636,32 @@
"[0-9]{9}$": "Matches exactly 9 digits following the prefix."
}
},
"Greece": {
"pattern": "^EL\\d{9}$",
"explanation": {
"^EL": "Matches the VAT prefix 'EL' for Greece.",
"\\d{9}$": "Matches exactly 9 digits following the prefix."
}
},
"Hungary": {
"pattern": "^HU\\d{8}$",
"explanation": {
"^HU": "Matches the VAT prefix 'HU' for Hungary.",
"\\d{8}$": "Matches exactly 8 digits following the prefix."
}
},
"Ireland": {
"pattern": "^IE\\d{7}[A-WY][A-I]?|IE[0-9+][A-Z+][0-9]{5}[A-WY]$",
"explanation": {
"^IE": "Matches the VAT prefix 'IE' for Ireland.",
"\\d{7}": "Matches exactly 7 digits following the prefix.",
"[A-WY]": "Matches a single letter from A to W or Y.",
"[A-I]?": "Optionally matches a single letter from A to I (used in certain VAT formats).",
"[0-9+][A-Z+]": "Matches an alternative format with a digit followed by a letter.",
"\\d{5}": "Matches 5 digits following the initial digit and letter.",
"[A-WY]$": "Matches the final letter in the VAT number from A to W or Y."
}
},
"Italy": {
"pattern": "^IT[0-9]{11}$",
"explanation": {
Expand Down

0 comments on commit 1eb0896

Please sign in to comment.