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.
我想要一个接受以下值的正则表达式:
并且不接受以下内容:
任何帮助,将不胜感激。
这将是这样的:[0-9]*(\.[0-9]{1,2})?
[0-9]*(\.[0-9]{1,2})?
其中{1,2}代表点后的 1-2 位数字。
{1,2}
一种可能的正则表达式是
\d*([.]\d{1,2})?
这将匹配零个或多个数字,然后是一个包含一个点和一个或两个数字的可选组。