正则表达式相关案例(很实用很强大)

1.密码的强度必须是包含大小写字母和数字的组合,不能使用特殊字符,长度在8-10之间
^(?=.\d)(?=.[a-z])(?=.*[A-Z]).{8,10}$

2.字符串仅能是中文

[1]{,}$

3.由数字、26个英文字母或下划线组成的字符串
^\w+$

4.校验E-Mail 地址
[\w!#\(%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#\)%&'+/=?^_`{|}~-]+)@(?:\w-?\.)+\w?

5.身份证15位
[2]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$

https://www.toutiao.com/i6711888232100921860/?tt_from=weixin&utm_campaign=client_share&wxshare_count=1&timestamp=1562893044&app=news_article&utm_source=weixin&utm_medium=toutiao_android&req_id=201907120857240100220620373373BE8&group_id=6711888232100921860


  1. \u4e00-\u9fa5 ↩︎

  2. 1-9 ↩︎

posted @ 2019-07-12 09:43  风许下的泪  阅读(902)  评论(0编辑  收藏  举报