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.
我需要一个长度为 6 的十进制正则表达式,例如需要正则表达式来匹配以下
123456.0 1.23456 12.3456 123.456 1234.56 12345.6 123456.0
我试过但没有成功。
这符合您的所有示例:
^(?=.{7}$)\d+\.\d+$|^\d{6}\.0$
在 rubular 上查看现场演示。