Regular Expression for Integer and Float

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TARUN

    #1

    Regular Expression for Integer and Float

    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

  • Andrew Morton

    #2
    Re: Regular Expression for Integer and Float

    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/Languag...ionSample1.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


    Comment

    Working...