Skip to content

Commit 9ab4b8c

Browse files
stefanbstaabm
authored andcommitted
Additional: BIC: allow digits 1-9 in second place of location
It seems that the BIC specification https://en.wikipedia.org/wiki/ISO_9362 was interpreted too strictly, only allowing digits 1 and 2 while those 2 just have a special meaning, but all 1-9 are allowed. Example: SSKNDE77XXX Sparkasse Nuernberg. Closes jquery-validation#1658.
1 parent e1e415b commit 9ab4b8c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/additional/bic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
* - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters)
1111
* - Next 2 characters - location code (letters and digits)
1212
* a. shall not start with '0' or '1'
13-
* b. second character must be a letter ('O' is not allowed) or one of the following digits ('0' for test (therefore not allowed), '1' for passive participant and '2' for active participant)
13+
* b. second character must be a letter ('O' is not allowed) or digit ('0' for test (therefore not allowed), '1' denoting passive participant, '2' typically reverse-billing)
1414
* - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits)
1515
*/
1616
$.validator.addMethod( "bic", function( value, element ) {
17-
return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() );
17+
return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() );
1818
}, "Please specify a valid BIC code" );

test/methods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,6 @@ test( "bic", function() {
852852
ok( !method( "PBNKDEFFXXX1" ), "Invalid BIC: too long" );
853853
ok( !method( "1BNKDEFF" ), "Invalid BIC: invalid digit" );
854854
ok( !method( "PBNKDE1F" ), "Invalid BIC: invalid digit" );
855-
ok( !method( "PBNKDEF3" ), "Invalid BIC: invalid digit" );
856855
ok( !method( "PBNKDEFO" ), "Invalid BIC: invalid char" );
857856
ok( !method( "INGDDEFFXAA" ), "Invalid BIC: invalid char" );
858857
ok( !method( "DEUTDEF0" ), "Invalid BIC: invalid digit" );
@@ -867,6 +866,7 @@ test( "bic", function() {
867866
ok( method( "AAFFFRP1" ), "Valid BIC" );
868867
ok( method( "DEUTDEFFAB1" ), "Valid BIC" );
869868
ok( method( "DEUTDEFFAXX" ), "Valid BIC" );
869+
ok( method( "SSKNDE77XXX" ), "Valid BIC" );
870870

871871
// BIC accept also lowercased values
872872
ok( !method( "pbnkdef" ), "Invalid BIC: too short" );

0 commit comments

Comments
 (0)