Regular expressions

A

Andrew Banks

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
 
C

cody

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}"
 
K

Kevin Spencer

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top