Results 1 to 3 of 3

Thread: Real number regular expression?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    137

    Real number regular expression?

    Does anyone know a regular expression that will check for a real number. The text box field can be 0 or any real dollar amount. It should be able to accept decimals that are valid numbers as well. It should not include numbers like 46.34.32 or letters.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Real number regular expression?

    from http://www.codeproject.com/tips/Regular_Expressions.asp

    (\+|-)?[1-9][0-9]*(\.[0-9]*)?

  3. #3
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Real number regular expression?

    Or simplified:

    ^([\+\-]{0,1}\d+\.?\d*)$
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width