正则表达式

线上正则测试地址(网上找的)

http://c.runoob.com/front-end/854?optionGlobl=global

http://tool.chinaz.com/regex/

正则表达式

1 手机号:11位数字

/^1[3-9]d{9}$/

2 正整数:0到9位正胜数

/^[0-9]{0,9}$/

3 正的两位小数点:

/^[0-9]+(.?[0-9]{1,2})?$/
或 /^[(0|[1-9]d)(.?[0-9]{1,2})?$/
4 0到9位整数,最多两位小数点:
/^ (0|[1-9]{1}d{0,8})((.[0-9]{1,2})?)$/
 或/^ (0|[1-9]{1}d{0,8})(.[0-9]{1,2})?$/
 
 
说明

特殊字符

限定符

 

原文地址:https://www.cnblogs.com/tong2018/p/14538136.html