Home All Groups Group Topic Archive Search About

Regular Expression for Integer and Float

Author
17 Aug 2006 6:51 AM
TARUN
Hello All

I want to ask regading regular expression.
I want to use such regular expression which only allow integers and
float value.
for example :--

12
12.34
23.456
0.5
0.0
0

I found but not able to find. Please Help me . Suggest me the regular
expression for that


with regards
Tarun sinha

Author
17 Aug 2006 11:08 AM
Andrew Morton
TARUN wrote:
> I want to use such regular expression which only allow integers and
> float value.
> for example :--
>
> 12
> 12.34
> 23.456
> 0.5
> 0.0
> 0
>
> I found but not able to find. Please Help me . Suggest me the regular
> expression for that

You really could have googled for "regular expression number" to find an
answer like the "//Function to test whether the string is valid number or
not" section at
http://www.c-sharpcorner.com/Language/RegExpressionSample1.asp

You didn't mention if number formats like 1.23e34, which is valid for a
floating-point number, or negative numbers were acceptable for your purpose.

Andrew