Regex for IBAN allowing for white spaces AND checking for exact length

后端 未结 7 2234
盖世英雄少女心
盖世英雄少女心 2020-12-08 22:56

I need to check an input field for a German IBAN. The user should be allowed to leave in white spaces and input should be validated to have a starting DE

7条回答
  •  感动是毒
    2020-12-08 23:46

    This is the correct regex to match DE IBAN account numbers:

    DE\d{2}[ ]\d{4}[ ]\d{4}[ ]\d{4}[ ]\d{4}[ ]\d{2}|DE\d{20}
    
    Pass:   DE89 3704 0044 0532 0130 00|||DE89370400440532013000
    Fail:   DE89-3704-0044-0532-0130-00
    

提交回复
热议问题