Regular expression in .net
-
hi i am facing a problem while building a regular expression for a numeric value having data type 9(13,3). The expression i build is "[0-9]{1,10}\.{0,1}[0-9]{0,3}" but the problem occures when i enter a value like "123456789012". It works fine when a value like "1234567890.123" is entered. Can anybody help me out of this prob? safii
-
hi i am facing a problem while building a regular expression for a numeric value having data type 9(13,3). The expression i build is "[0-9]{1,10}\.{0,1}[0-9]{0,3}" but the problem occures when i enter a value like "123456789012". It works fine when a value like "1234567890.123" is entered. Can anybody help me out of this prob? safii
\d{1,10}(?:\.\d{1,3})? Notes: ~ Use \d instead of [0-9] ~ Use ? instead if {0,1} ~ Group the decimal and the following digits so either both or neither must appear. ~ This presumes that you want "123" and "123.1" to be valid, but "123." to be invalid, change the second 1 to a 0 if that's not true. ~ Keep in mind that you need something before and after that expression as well to delimit it. If your numbers were each on a line by themselves, then a ^ on the front and a $ on the end would work. But you need to avoid matching 991111111111.1119 the valid number in the middle of the bigger number there. -Blake