简体   繁体   English

验证所有国家/地区的身份证号码

[英]Validate number from id card from all countries

anyone knows any function or regular expression to validate the id number of id card from all countries? 有谁知道任何函数或正则表达式来验证所有国家/地区的身份证号?

I found this regular expression, who validates id number from Spain but i need validate all id number from all countries. 我找到了这个正则表达式,该人可以验证来自西班牙的ID号,但我需要验证所有国家/地区的所有ID号。

^((([A-Z]|[a-z])\d{8})|(\d{8}([A-Z]|[a-z])))$

Thanks. 谢谢。

You cannot validate id numbers from all countries by one regular expressions becouse each country has a different policy for example in my country it is validated by ^\\\\d{14}$ ae, 14 numbers. 您无法使用一个正则表达式来验证所有国家/地区的ID号,因为每个国家/地区都有不同的政策,例如在我的国家/地区,它通过^\\\\d{14}$ ae(14个数字)进行验证。

What you can do is associate each country with a regex pattern and validate the id depending on its country. 您可以做的是将每个国家/地区与正则表达式模式相关联,并根据其国家/地区验证ID。

我认为这是不可能的,因为不同国家/地区的格式和验证规则不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM