1.校验密码强度
^(?=.\d)(?=.[a-z])(?.*[A-Z]).{8,10}$
2.校验中文
^[\u4e00-\u9fa5]{0,}$
3.由数字、26个英文字母或下划线组成的字符串
^\w+$
4.校验e-mail地址
[\w!#$%&’+/=?^_{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_
{|}~-]+)@(?:\w?\
.)+\w?
5.校验身份证号码
15位的:^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3} 18位的:[1−9]\d5[1−9]\d3((0\d)|(1[0−2]))(([0|1|2]\d)|3[0−1])\d3([0−9]|X)
6.校验日期
^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-
(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|
[2468][048]|[13579][26])00)-02-29)$
7.校验金额
^[0-9]+(.[0-9]{2})?$
8.校验手机号
^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
9.判断IE的版本
^.MSIE 5-8?(?!.*Trident\/[5-9]\.0).$
10.校验IP-v4的地址
\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-
9]?)\b
11.校验IP-v6地址
(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:)
{1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]
{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-
9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:
((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0
{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1
{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\
.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))
12.检查URL的前缀
if (!s.match(/^[a-zA-Z]+:\/\//))
{
s = ‘http://’ + s;
}
13.提取URL链接[/b]下面的这个表达式可以筛选出一段文本中的URL
^(f|ht){1}(tp|tps):\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?
14.文件路径及扩展名校验
^([a-zA-Z]\:|\\)[^\\]+[^\/:?”<>|]+\.txt(l)?$
15.提取Color Hex Codes
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
16.提取网页图片
\< [img][^\\>][src] = [\”\’]{0,1}([^\”\’\ >]*)
17.提取页面超链接
(