User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 374,198 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,630 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 288 | Replies: 4 | Solved
Reply
Join Date: May 2008
Posts: 15
Reputation: menelaussa is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
menelaussa menelaussa is offline Offline
Newbie Poster

Regular Expressions

  #1  
May 21st, 2008
Hi, can someone to help me to write an regular expression for a number from 1-100.
I need to validate an age field.

Thank you
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: Regular Expressions

  #2  
May 21st, 2008
You can use RangeValidator for your requirement.Try this!

<asp:RangeValidator ID="validateage" runat="server" Type="Integer" ControlToValidate="txtage" MinimumValue="1" 
        MaximumValue="100" ErrorMessage="Your age must be between 1 and 100" Display="Dynamic" ></asp:RangeValidator>
Reply With Quote  
Join Date: May 2008
Posts: 15
Reputation: menelaussa is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
menelaussa menelaussa is offline Offline
Newbie Poster

Re: Regular Expressions

  #3  
May 21st, 2008
I found it
^[1-9][0-9]?[0-9]?$
Reply With Quote  
Join Date: May 2008
Posts: 15
Reputation: menelaussa is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
menelaussa menelaussa is offline Offline
Newbie Poster

Re: Regular Expressions

  #4  
May 21st, 2008
Thank you nandhinijp. Your solutin is better then mine.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: Regular Expressions

  #5  
May 21st, 2008
If its ok, Mark as Solved.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 5:14 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC