前端之家收集整理的这篇文章主要介绍了
正则拓展: 匹配大陆和港式身份证,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
产品有香港的小伙伴入驻..身份证校验这块需要做一个前台校验,尝试了许久…就放出来了
两种写法:
(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X|x)|[A-Za-z]{1}\d{6}[(\d)]{3}
([A-Za-z](\d{6})\(\d\))|(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X|x)