我正在忙着做这件事,以为我会把它放在那里.
它必须是一个最多3个单位且最多5个小数位的数字等
有效
无效
编辑它需要大于或等于零.
oha*_*aal 13
根据您最近对问题的更改,这里是一个更新的正则表达式,它将匹配所有> = 0和<1000
^\d{1,3}(?:\.\d{1,5})?$
^\___/ \/ ^\/\___/ |
| ^ ^ | | | `- Previous is optional (group of dot and minimum 1 number between 0-9 and optionally 4 extra numbers between 0-9)
| | | | | `- Match 1-5 instances of previous (single number 0-9)
| | | | `- Match a single number 0-9
| | | `- The dot between the 1-3 first number(s) and the 1-5 last number(s).
| | `- This round bracket should not create a backreference
| `- Match 1-3 instances of previous (single number 0-9)
`- Match a single number 0-9
Run Code Online (Sandbox Code Playgroud)
^是行的开始,$是行尾.
有效
无效