RegEx编号[-99.99 ..- 0.01] + [0.01..99.99](RegEx number [-99.99..-0.01]+[0.01..99.99])
我想验证一个数字。 此数字必须为-99.99至+99.99,但0(零)除外。 我想出了这个RegEx表达式
[-+]?((\d{1,2}\.?\d{0,1}[1-9])|(\d{0,1}[1-9]))但它不处理这种类型的数量:
x0 xy.00任何想法?
编辑:我正在尝试对xsd文件进行限制。
I want to validate a number. This number must be from -99.99 to +99.99 but except 0 (zero). I came up with this RegEx expression
[-+]?((\d{1,2}\.?\d{0,1}[1-9])|(\d{0,1}[1-9]))but it does not handle number of this type:
x0 xy.00Any idea?
Edit: I am trying to do a restriction for xsd file.
最满意答案
尝试:
[+-]?([1-9]\d?(\.\d\d?)?|0\.[1-9]\d?||0\.0[1-9])含义:
[+-]? # optional '+' or '-' ( # [1-9]\d?(\.\d\d?)? # 1 - 99.99 | # OR 0\.[1-9]\d? # 0.1 - 0.99 | # OR 0\.0[1-9] # 0.01 - 0.09 ) #Try:
[+-]?([1-9]\d?(\.\d\d?)?|0\.[1-9]\d?||0\.0[1-9])meaning:
[+-]? # optional '+' or '-' ( # [1-9]\d?(\.\d\d?)? # 1 - 99.99 | # OR 0\.[1-9]\d? # 0.1 - 0.99 | # OR 0\.0[1-9] # 0.01 - 0.09 ) #更多推荐
发布评论