Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Regular expressions

Reply
Thread Tools

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

Thanks in advance


 
Reply With Quote
 
 
 
 
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..
>
> Thanks in advance
>
>



 
Reply With Quote
 
 
 
 
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


 
Reply With Quote
 
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..
>
> Thanks in advance
>
>



 
Reply With Quote
 
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..
>
> Thanks in advance
>
>



 
Reply With Quote
 
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..
>
> Thanks in advance
>
>


 
Reply With Quote
 
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


 
Reply With Quote
 
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
Big things are made up
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..
> >
> > Thanks in advance
> >
> >

>



 
Reply With Quote
 
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Regular Expressions in ASP.net Jay Douglas ASP .Net 3 11-03-2003 08:09 PM
Regular expressions mark Perl 4 10-28-2003 12:37 PM
perl regular expressions return last matched occurence? Dustin D. Perl 1 08-28-2003 01:51 AM
matching curly braces and regular expressions Dustin D. Perl 0 08-26-2003 11:18 PM
Add custom regular expressions to the validation list of available expressions Jay Douglas ASP .Net 0 08-15-2003 10:19 PM



Advertisments