title: Detect IBAN in text
body: <p>There is a simple regex pattern that detect IBAN in a text (including specific country formatting ?)</p>
  
  <p>Actually I am finding IBAN with this regex :</p>
  
  <pre><code>[a-zA-Z]{2}[0-9]{2}[0-9a-zA-Z]{10,30}
  </code></pre>
  
  <p>But this doesn't match formatted IBAN like (normal, I don't have introduced whitespaces detection) :</p>
  
  <pre><code>FR76 30003 02420 002202XXXXX 77
  </code></pre>
  
  <p>or</p>
  
  <pre><code>PT50 0002 0123 1234 5678 9015 4
  </code></pre>
  
  <p>Can you help me ? Where can I find all formatted IBAN pattern by country ?</p>
  
  <p>Example :</p>
  
  <blockquote>
    <p>"My IBAN is PT50 0002 0123 1234 5678 9015 1 catch it with a regex and
    these one PT50000201231234567890151 too !"</p>
  </blockquote>
  
  <p>I would like to extract/process "PT50 0002 0123 1234 5678 9015 1" and "PT50000201231234567890151".</p>
  
  <p><strong>Edit:</strong>
  Solution 1 - Very long pattern:</p>
  
  <pre><code>((NO)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{3}|(NO)[0-9A-Z]{13}|(BE)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}|(BE)[0-9A-Z]{14}|(DK|FO|FI|GL|NL)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{2}|(DK|FO|FI|GL|NL)[0-9A-Z]{16}|(MK|SI)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{3}|(MK|SI)[0-9A-Z]{17}|(BA|EE|KZ|LT|LU|AT)[0-9A-Z]{2}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}[ ][0-9A-Z]{4}|(BA|EE|KZ|LT|LU|AT)[0-9A-Z]{18}|(HR|LI|LV|CH)[0-9A-Z]{2}[ ][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