HighTechTalks DotNet Forums  

RegularExpressionValidator question

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss RegularExpressionValidator question in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Frank Rizzo
 
Posts: n/a

Default RegularExpressionValidator question - 12-29-2007 , 03:23 PM






Hello,

Trying to setup RegularExpressionValidator to validate a textbox. I am
trying to make sure that the user enters the word Green. The case does
not matter.

However, i am totally new to Regex. Could I get some help?

Thanks.

Reply With Quote
  #2  
Old   
Phil H
 
Posts: n/a

Default Re: RegularExpressionValidator question - 12-29-2007 , 06:06 PM






On 29 Dec, 20:23, Frank Rizzo <n... (AT) none (DOT) net> wrote:
Quote:
Hello,

Trying to setup RegularExpressionValidator to validate a textbox. *I am
trying to make sure that the user enters the word Green. *The case does
not matter.

However, i am totally new to Regex. *Could I get some help?

Thanks.
Hi Frank

It just so happens that I too have been delving into the undergound
world of "Regular expressions" recently. My need was a bit more
complex than yours though.

I'm going to assume at this point that if you were given a patterrn
string you can do the rest. How about:

"(green)+"

when you create the Regex object there is a parameter that specifies
"ignore case". Check it out.

To decide whether it occurs or not you only need to test the "success"
property of the "match" object.

I hope I've pitched the above at the right level, let me know
otherwise.


Reply With Quote
  #3  
Old   
Riki
 
Posts: n/a

Default Re: RegularExpressionValidator question - 12-30-2007 , 03:26 AM



Frank Rizzo wrote:
Quote:
Hello,

Trying to setup RegularExpressionValidator to validate a textbox. I
am trying to make sure that the user enters the word Green. The case
does not matter.

However, i am totally new to Regex. Could I get some help?

Thanks.
Try ^(green)|(Green)|(GREEN)$

Don't forget to add a RequiredFieldValidator as well.
If you don't, a blank field will still be validated.

--
Riki




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.