In winforms, I use Regular expression to check decimal format. Please 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.