title: Regex to capture BBAN from IBAN?
body: <p>I found a regular expression that matches all IBAN numbers from all countries <a href="http://snipplr.com/view/15322/iban-regex-all-ibans/" rel="nofollow">here</a>:</p>
  
  <pre><code>[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}
  </code></pre>
  
  <p>I tried to adjust it so that is has two capturing groups, one for the country code (the first two letters), and one for the account number (last 10 digits?)</p>
  
  <pre><code>"^(?&lt;CountryCode&gt;[a-zA-Z]{2})[0-9]{2}[a-zA-Z0-9]{4}(?&lt;AccountNumber&gt;[0-9]{7}([a-zA-Z0-9]?){0,16})"
  </code></pre>
  
  <p>The regex above does not work to capture the account number. I want to capture the last 10 digits basically, but since BBAN is different in all countries (that is why IBAN is invented) this is not always similar. </p>
  
  <p>I hope someone can provide me with some ideas.</p>
  
  <p>/Edit I changed it to:</p>
  
  <pre><code>"^(?&lt;CountryCode&gt;[a-zA-Z]{2})[0-9]{2}[a-zA-Z0-9]{4}([0]*)(?&lt;AccountNumber&gt;([a-zA-Z0-9]?){0,16})";
  </code></pre>
  
  <p>and this works in my unit test on a Dutch number, I am not sure about other countries though. I would still love to hear your remarks.</p>