Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我为我的糟糕写作道歉,英语不是我的第一语言。
我需要为此进行正则表达式
好的
-1000000.00 = 7 digits and 2 decimals with negative -100 1000000.00 100
坏的
-10000000 = 8 digits 100.000 = 3 decimals -100.000 = 3 decimals
tnx 的帮助。
这应该有效。应该允许一个可选的减号、0 - 7 个数字和一个可选的点,后面有 2 个数字:
^[\-]?[0-9]{0,7}([\.][0-9][0-9])?$
尝试使用以下正则表达式来验证您的数字和小数
Regex : (-)?[0-9]{0,7}(\.[0-9]{2})?
你可以在这里看到正则表达式的演示