Skip to content

Instantly share code, notes, and snippets.

@hpmewes
Created July 18, 2012 07:51
Show Gist options
  • Save hpmewes/3134906 to your computer and use it in GitHub Desktop.
Save hpmewes/3134906 to your computer and use it in GitHub Desktop.

Revisions

  1. SCS revised this gist Jul 18, 2012. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    /**
    * Check for Germany IBAN
    */
    var regexIBANDE = '([A-Z]{2})([0-9]{2})([0-9]{8})([0-9]{10})';
    var matchIBANDE = $('#someid').val().match(regexIBANDE);

  2. SCS created this gist Jul 18, 2012.
    19 changes: 19 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    var regexIBANDE = '([A-Z]{2})([0-9]{2})([0-9]{8})([0-9]{10})';
    var matchIBANDE = $('#someid').val().match(regexIBANDE);

    console.log('match: iban '+matchIBANDE);

    // iban correct
    if(matchIBANDE != null) {
    var IBAN = matchIBANDE[0];
    var bankCode = matchIBANDE[3];
    var regexBankAccountNr = '([0]*)([0-9]*)'
    var bankAccountNr = matchIBANDE[4];

    console.log('match: bank '+bankAccountNr.match(regexBankAccountNr));
    bankAccountNr = bankAccountNr.match(regexBankAccountNr);

    // set bank data
    $('#bank_account_bank_account_nr').val(bankAccountNr[2]);
    $('#bank_account_bank_account_bank_code').val(bankCode);
    }