Simple regular expression for decimal numbers?
Posted
by finch
on Stack Overflow
See other posts from Stack Overflow
or by finch
Published on 2008-11-21T07:29:43Z
Indexed on
2010/05/19
16:10 UTC
Read the original article
Hit count: 229
regex
I know this may be the simplest question ever asked on Stack Overflow, but what is the regular expression for a decimal with a precision of 2?
Valid examples:
123.12
2
56754
92929292929292.12
0.21
3.1
Invalid examples:
12.1232
2.23332
e666.76
Sorry for the lame question, but for the life of me I haven't been able to find anyone that can help!
The decimal place may be option, and that integers may also be included.
© Stack Overflow or respective owner