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

后端 未结 7 2243
盖世英雄少女心
盖世英雄少女心 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-09 00:03

    Original:

    ^[DE]{2}([0-9a-zA-Z]{20})$
    

    Regular expression visualization

    Debuggex Demo

    Modified:

    ^DE(?:\s*[0-9a-zA-Z]\s*){20}$
    

    Regular expression visualization

    Debuggex Demo

提交回复
热议问题