# Regular expressions

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

1. ### Andrew BanksGuest

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..

Andrew Banks, Apr 21, 2004

2. ### Merkisson JourhanssenGuest

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..
>
>
>

Merkisson Jourhanssen, Apr 21, 2004

3. ### codyGuest

> 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
4. ### Maxim KazitovGuest

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..
>
>
>

Maxim Kazitov, Apr 21, 2004
5. ### Maxim KazitovGuest

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..
>
>
>

Maxim Kazitov, Apr 21, 2004
6. ### Ken Cox [Microsoft MVP]Guest

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..
>
>
>

Ken Cox [Microsoft MVP], Apr 21, 2004
7. ### codyGuest

cody, Apr 21, 2004
8. ### Kevin SpencerGuest

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
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..
> >
> >
> >

>

Kevin Spencer, Apr 21, 2004
9. ### StingKGuest

StingK, Apr 27, 2004