开发者

Decimal format in Regular Expression

In winforms, I use Regular expression to check decimal format. Pl开发者_如何学Pythonease check whether my format is correct or not.

For example

123456.1234 

"^{0,1}[0-9]{0,1}[0-9]{0,1}[0-9]{0,1}[0-9]{0,1}[0-9]{0,1}[.]{0,1}[0-9]{0,1}[0-9]{0,1}[0-9]{0,1}$"

Is there any better format?

Actually I just wanna get 6 numeric and 4 decimal points only. How to format it?


Wouldn't ^\d+(\.\d)?$ be better?

This check for a number at the start of the string, then maybe a . followed by another number.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜