use*_*605 -1 javascript regex jquery formatter
我正在使用:http://firstopinion.github.io/formatter.js/index.html来屏蔽输入.
我正在查看"模式"选项,并且在编写带有可选小数位的1或2位数的正则表达式时遇到问题.
良好的投入:
2.5
12.5
.5
1
输入错误:
.25
123.5
1.55
感谢您的任何帮助!
Bar*_*mar 11
^\d{0,2}(?:\.\d)?$
Run Code Online (Sandbox Code Playgroud)
\d{0,2} = 0-2位数\.\d =小数点后跟1位数(?: ... )? =可选组^并将其$锚定到开始和结束