REGEX question

Discussion in 'ASP .Net' started by pvong, Dec 20, 2007.

  1. pvong

    pvong Guest

    Can someone help me write a regex that will accept number but NO COMMAS.

    Yes to
    123456.78

    No to
    123,456.78

    Thanks!
    Phil
    pvong, Dec 20, 2007
    #1
    1. Advertising

  2. On Dec 20, 8:33 pm, "pvong" <phillip*at*yahoo*dot*com> wrote:
    > Can someone help me write a regex that will accept number but NO COMMAS.
    >
    > Yes to
    > 123456.78
    >
    > No to
    > 123,456.78
    >


    Hi Phil,

    Do you need it for the RegularExpressionValidator control?

    Try this one

    ^\d+(\.\d\d)?$

    Hope it works
    Alexey Smirnov, Dec 20, 2007
    #2
    1. Advertising

  3. On Dec 20, 8:38 pm, Alexey Smirnov <> wrote:
    > On Dec 20, 8:33 pm, "pvong" <phillip*at*yahoo*dot*com> wrote:
    >
    > > Can someone help me write a regex that will accept number but NO COMMAS.

    >
    > > Yes to
    > > 123456.78

    >
    > > No to
    > > 123,456.78

    >
    > Hi Phil,
    >
    > Do you need it for the RegularExpressionValidator control?
    >
    > Try this one
    >
    > ^\d+(\.\d\d)?$
    >
    > Hope it works


    If the digits after the decimal point are always there:

    ^\d+\.\d\d$
    Alexey Smirnov, Dec 20, 2007
    #3
  4. pvong

    pvong Guest

    Yes and this is perfect!!!!
    Thanks!


    "Alexey Smirnov" <> wrote in message
    news:...
    > On Dec 20, 8:33 pm, "pvong" <phillip*at*yahoo*dot*com> wrote:
    >> Can someone help me write a regex that will accept number but NO COMMAS.
    >>
    >> Yes to
    >> 123456.78
    >>
    >> No to
    >> 123,456.78
    >>

    >
    > Hi Phil,
    >
    > Do you need it for the RegularExpressionValidator control?
    >
    > Try this one
    >
    > ^\d+(\.\d\d)?$
    >
    > Hope it works
    >
    pvong, Dec 20, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmViQnVzaGVsbA==?=

    Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine?

    =?Utf-8?B?SmViQnVzaGVsbA==?=, Oct 22, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    688
    =?Utf-8?B?SmViQnVzaGVsbA==?=
    Oct 22, 2005
  2. Rick Venter

    perl regex to java regex

    Rick Venter, Oct 29, 2003, in forum: Java
    Replies:
    5
    Views:
    1,604
    Ant...
    Nov 6, 2003
  3. Replies:
    2
    Views:
    589
  4. Xah Lee
    Replies:
    1
    Views:
    927
    Ilias Lazaridis
    Sep 22, 2006
  5. Replies:
    3
    Views:
    728
    Reedick, Andrew
    Jul 1, 2008
Loading...

Share This Page