Regular expressions

Discussion in 'ASP .Net' started by Andrew Banks, Apr 21, 2004.

  1. Andrew Banks

    Andrew Banks Guest

    Can anyone help me out with regular expressions for the following?

    1: Check that a number entered contains no letters and is between 0 and 99.
    Numers under ten can be entered as "01" "02" "03" or "1" "2" "3"

    2: Check that a number contains 3 numbers and no letters. Number should be
    between 0 and 999 and must be entered as "001" "002" "003" "654" "456" "654"
    etc..

    Thanks in advance
    Andrew Banks, Apr 21, 2004
    #1
    1. Advertising

  2. http://www.regexlib.com/



    "Andrew Banks" <> wrote in message
    news:J3yhc.150$...
    > Can anyone help me out with regular expressions for the following?
    >
    > 1: Check that a number entered contains no letters and is between 0 and

    99.
    > Numers under ten can be entered as "01" "02" "03" or "1" "2" "3"
    >
    > 2: Check that a number contains 3 numbers and no letters. Number should be
    > between 0 and 999 and must be entered as "001" "002" "003" "654" "456"

    "654"
    > etc..
    >
    > Thanks in advance
    >
    >
    Merkisson Jourhanssen, Apr 21, 2004
    #2
    1. Advertising

  3. Andrew Banks

    cody Guest

    > 1: Check that a number entered contains no letters and is between 0 and
    99.
    > Numers under ten can be entered as "01" "02" "03" or "1" "2" "3"


    "[0..9][0..9]"

    > 2: Check that a number contains 3 numbers and no letters. Number should be
    > between 0 and 999 and must be entered as "001" "002" "003" "654" "456"

    "654"

    "[0..9][0..9][0..9]"

    or

    "\d{3}"

    --
    cody

    [Freeware, Games and Humor]
    www.deutronium.de.vu || www.deutronium.tk
    cody, Apr 21, 2004
    #3
  4. 1. \d{2}
    2. \d{3}


    "Andrew Banks" <> wrote in message
    news:J3yhc.150$...
    > Can anyone help me out with regular expressions for the following?
    >
    > 1: Check that a number entered contains no letters and is between 0 and

    99.
    > Numers under ten can be entered as "01" "02" "03" or "1" "2" "3"
    >
    > 2: Check that a number contains 3 numbers and no letters. Number should be
    > between 0 and 999 and must be entered as "001" "002" "003" "654" "456"

    "654"
    > etc..
    >
    > Thanks in advance
    >
    >
    Maxim Kazitov, Apr 21, 2004
    #4
  5. Sorry,
    \d{1,2}
    \d{3}

    "Andrew Banks" <> wrote in message
    news:J3yhc.150$...
    > Can anyone help me out with regular expressions for the following?
    >
    > 1: Check that a number entered contains no letters and is between 0 and

    99.
    > Numers under ten can be entered as "01" "02" "03" or "1" "2" "3"
    >
    > 2: Check that a number contains 3 numbers and no letters. Number should be
    > between 0 and 999 and must be entered as "001" "002" "003" "654" "456"

    "654"
    > etc..
    >
    > Thanks in advance
    >
    >
    Maxim Kazitov, Apr 21, 2004
    #5
  6. BTW, there's a great ree tool for testing and debugging regular expressions:

    Regular Expression Workbench (V2.00)

    http://www.gotdotnet.com/Community/...mpleGuid=C712F2DF-B026-4D58-8961-4EE2729D7322

    "Andrew Banks" <> wrote in message
    news:J3yhc.150$...
    > Can anyone help me out with regular expressions for the following?
    >
    > 1: Check that a number entered contains no letters and is between 0 and
    > 99.
    > Numers under ten can be entered as "01" "02" "03" or "1" "2" "3"
    >
    > 2: Check that a number contains 3 numbers and no letters. Number should be
    > between 0 and 999 and must be entered as "001" "002" "003" "654" "456"
    > "654"
    > etc..
    >
    > Thanks in advance
    >
    >
    Ken Cox [Microsoft MVP], Apr 21, 2004
    #6
  7. Andrew Banks

    cody Guest

    cody, Apr 21, 2004
    #7
  8. I haven't tried that one, Ken, but I have used this other one (Regex Coach)
    that is also free:

    http://weitz.de/index.html

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:#...
    > BTW, there's a great ree tool for testing and debugging regular

    expressions:
    >
    > Regular Expression Workbench (V2.00)
    >
    >

    http://www.gotdotnet.com/Community/...mpleGuid=C712F2DF-B026-4D58-8961-4EE2729D7322
    >
    > "Andrew Banks" <> wrote in message
    > news:J3yhc.150$...
    > > Can anyone help me out with regular expressions for the following?
    > >
    > > 1: Check that a number entered contains no letters and is between 0 and
    > > 99.
    > > Numers under ten can be entered as "01" "02" "03" or "1" "2" "3"
    > >
    > > 2: Check that a number contains 3 numbers and no letters. Number should

    be
    > > between 0 and 999 and must be entered as "001" "002" "003" "654" "456"
    > > "654"
    > > etc..
    > >
    > > Thanks in advance
    > >
    > >

    >
    Kevin Spencer, Apr 21, 2004
    #8
  9. Andrew Banks

    StingK Guest

    StingK, Apr 27, 2004
    #9
    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. Jay Douglas

    Custom Regular Expressions in ASP.net

    Jay Douglas, Nov 2, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    605
    mikeb
    Nov 3, 2003
  2. mark

    Regular expressions

    mark, Jun 30, 2003, in forum: Perl
    Replies:
    4
    Views:
    1,718
  3. Dustin D.
    Replies:
    1
    Views:
    11,179
  4. Jay Douglas
    Replies:
    0
    Views:
    598
    Jay Douglas
    Aug 15, 2003
  5. Noman Shapiro
    Replies:
    0
    Views:
    232
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page