Velocity Reviews > Regular expressions

# Regular expressions

Andrew Banks
Guest
Posts: n/a

 04-21-2004
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
Guest
Posts: n/a

 04-21-2004
http://www.regexlib.com/

"Andrew Banks" <(E-Mail Removed)> wrote in message
news:J3yhc.150\$(E-Mail Removed)...
> 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..
>
>
>

cody
Guest
Posts: n/a

 04-21-2004
> 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

Maxim Kazitov
Guest
Posts: n/a

 04-21-2004
1. \d{2}
2. \d{3}

"Andrew Banks" <(E-Mail Removed)> wrote in message
news:J3yhc.150\$(E-Mail Removed)...
> 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
Guest
Posts: n/a

 04-21-2004
Sorry,
\d{1,2}
\d{3}

"Andrew Banks" <(E-Mail Removed)> wrote in message
news:J3yhc.150\$(E-Mail Removed)...
> 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]
Guest
Posts: n/a

 04-21-2004
BTW, there's a great ree tool for testing and debugging regular expressions:

Regular Expression Workbench (V2.00)

http://www.gotdotnet.com/Community/U...1-4EE2729D7322

"Andrew Banks" <(E-Mail Removed)> wrote in message
news:J3yhc.150\$(E-Mail Removed)...
> 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..
>
>
>

cody
Guest
Posts: n/a

 04-21-2004
An even better tool is "The RegEx Coach" (freeware)

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk

Kevin Spencer
Guest
Posts: n/a

 04-21-2004
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]" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> BTW, there's a great ree tool for testing and debugging regular

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

http://www.gotdotnet.com/Community/U...1-4EE2729D7322
>
> "Andrew Banks" <(E-Mail Removed)> wrote in message
> news:J3yhc.150\$(E-Mail Removed)...
> > 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..
> >
> >
> >

>

StingK
Guest
Posts: n/a

 04-27-2004
"cody" <(E-Mail Removed)> wrote in news:uACRZp9JEHA.228
@TK2MSFTNGP10.phx.gbl:

> An even better tool is "The RegEx Coach" (freeware)
>

Even better IMO is this ****ah from Roy: The Regulator

http://royo.is-a-geek.com/iserializable/regulator/