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.
精彩评论