Regex for US Federal Tax ID (EIN)

前端 未结 2 708
失恋的感觉
失恋的感觉 2021-01-29 13:58

In the pattern attribute of an input tag, I am using the following regular expression for validation of the US Federal Tax ID field.

pattern=\"^([07][1-7]|1[0-6]         


        
2条回答
  •  鱼传尺愫
    2021-01-29 14:23

    I have written a regex which satisfy the requirements.

    pattern="^((?!11-1111111)(?!22-2222222)(?!33-3333333)(?!44-4444444)(?!55-5555555)(?!66-6666666)(?!77-7777777)(?!88-8888888)(?!99-9999999)(?!12-3456789)(?!00-[0-9]{7})([0-9]{2}-[0-9]{7}))*$"
    

    Though it is not an efficient one. Anyone has more efficient regex?

提交回复
热议问题