Skip to content

Commit

Permalink
Policheck: add "regions" to "countries" (dotnet#32657)
Browse files Browse the repository at this point in the history
* Policheck: add "regions" to "countries"

* Policheck: add "region(s)" to "country" & "countries"

For geopolitical reasons, we usually want to include "region" when talking about "country".
  • Loading branch information
garycentric authored Nov 18, 2022
1 parent 82c35f5 commit c146347
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ $.validator.addMethod("iban", function(value, element) {
};

bbanpattern = bbancountrypatterns[countrycode];
// As new countries will start using IBAN in the
// As new countries/regions start using IBAN in the
// future, we only check if the countrycode is known.
// This prevents false negatives, while almost all
// false positives introduced by this, will be caught
// by the checksum validation below anyway.
// Strict checking should return FALSE for unknown
// countries.
// countries and regions.
if (typeof bbanpattern !== "undefined") {
ibanregexp = new RegExp("^[A-Z]{2}\\d{2}" + bbanpattern + "$", "");
if (!(ibanregexp.test(iban))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ $.validator.addMethod("giroaccountNL", function(value, element) {

/**
* IBAN is the international bank account number.
* It has a country/region - specific format, that is checked here too
* It has a country/region-specific format, that is checked here too
*/
$.validator.addMethod("iban", function(value, element) {
// some quick simple tests to prevent needless work
Expand All @@ -437,7 +437,7 @@ $.validator.addMethod("iban", function(value, element) {
cOperator = "",
countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p;

// check the country/region code and find the country/region specific format
// check the country/region code and find the country/region-specific format
countrycode = iban.substring(0, 2);
bbancountrypatterns = {
"AL": "\\d{8}[\\dA-Z]{16}",
Expand Down Expand Up @@ -507,17 +507,17 @@ $.validator.addMethod("iban", function(value, element) {
};

bbanpattern = bbancountrypatterns[countrycode];
// As new countries will start using IBAN in the
// As new countries/regions start using IBAN in the
// future, we only check if the countrycode is known.
// This prevents false negatives, while almost all
// false positives introduced by this, will be caught
// by the checksum validation below anyway.
// Strict checking should return FALSE for unknown
// countries.
// countries and regions.
if (typeof bbanpattern !== "undefined") {
ibanregexp = new RegExp("^[A-Z]{2}\\d{2}" + bbanpattern + "$", "");
if (!(ibanregexp.test(iban))) {
return false; // invalid country/region specific format
return false; // invalid country/region-specific format
}
}

Expand Down

0 comments on commit c146347

Please sign in to comment.