Using regular expressions/143/zh-cn: Difference between revisions
From LimeSurvey Manual
(Created page with "==Number validation with thousand separator== Space as separator, no minus <source lang="html">/^(?!0)\d{1,3}(\ \d{3})*$/</source> Dot as separator, minus allowed <source la...") |
No edit summary |
||
Line 1: | Line 1: | ||
== | ==用千位分隔符进行数字验证== | ||
空格做分隔符,没有减号 | |||
<source lang="html">/^(?!0)\d{1,3}(\ \d{3})*$/</source> | <source lang="html">/^(?!0)\d{1,3}(\ \d{3})*$/</source> | ||
点做分隔符,允许减号 | |||
<source lang="html">/^-?(?!0)\d{1,3}(\.\d{3})*$/</source> | <source lang="html">/^-?(?!0)\d{1,3}(\.\d{3})*$/</source> |
Latest revision as of 09:21, 21 October 2020
用千位分隔符进行数字验证
空格做分隔符,没有减号
/^(?!0)\d{1,3}(\ \d{3})*$/
点做分隔符,允许减号
/^-?(?!0)\d{1,3}(\.\d{3})*$/