正则表达式总结


总结:

匹配邮箱地址

(?:\w|\d)*-?(?:\w|\d)*@(?:\w|\d)*-?(?:\w|\d)*(?:\.com\.cn|\.com)

test@hot-mail.com
v-ip@magedu.com
web .manager@magedu.com.cn
super.user@google.com
a@w-a-com

 匹配html

(\w+)

马哥教育

匹配url

(?:http://|https://)?[A-Za-z0-9\.]+(?:\.com.cn|\.com)(?:/index\.html)?

http://www.magedu.com/index.html
https://login.magedu.com
file:///ect/sysconfig/network

匹配二代身份证

^\d{17}[\w\d]$

321105700101003

321105197001010030

11210020170101054X

强密码:10-15位长度,必须包含大写字母、小写字母、数字、下划线

^[A-Za-z0-9_]{10,15}$

Aatb32_67mnq
Aatb32_67m.nq
中国是一个伟大的国家aA_8