小智 8
试试这个!我也用这种方式
"^-?[0-9]{1,12}(?:\.[0-9]{1,4})?$"
Run Code Online (Sandbox Code Playgroud)
规则:
ex: ^-?[0-9]{1,12}(?:\.[0-9]{1,4})?$
^ # Start of string
[0-9]{1,12} # Match 1-12 digits (i. e. 0-999999999999)
(?: # Try to match...
\. # a decimal point
[0-9]{1,4} # followed by one to three digits (i. e. 0-9999)
)? # ...optionally
$ # End of string
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
36319 次 |
| 最近记录: |