For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > May 2004 > RegularExpressionValidator doesn't ignore case









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RegularExpressionValidator doesn't ignore case
A.M

2004-05-28, 4:40 pm

Hi,

How can I set the option of RegularExpressionValidator to
RegexOptions.IgnoreCase ?

Thanks,
Alan


Chris R. Timmons

2004-05-28, 10:39 pm

"A.M" <nospam1@online.nospam> wrote in
news:e33xk5OREHA.3528@TK2MSFTNGP09.phx.gbl:

> Hi,
>
> How can I set the option of RegularExpressionValidator to
> RegexOptions.IgnoreCase ?


Alan,

There is no property in the RegularExpressionValidator control that
allows regex options to be set.

If your control does both client-side and server-side validation, the
regex must use a subset of regular expression syntax that both
JScript and .Net can execute. In this case, to make a regex ignore
case it is necessary to use a character class construct like [a-zA-Z]
to match both upper and lower case characters.

If your validation is done on the server-side only, you can use the
more powerful .Net regular expression syntax. In this case, you can
place the (?i) option at the beginning of the regex to tell it to
ignore case.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Ali.M

2004-05-29, 9:39 am

Thanks Chris,

I actually using server side validation, so I am going to try ?i.

Alan



"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xns94F7D1A488BEAcrtimmonscrtimmonsi
n@207.46.248.16...
> "A.M" <nospam1@online.nospam> wrote in
> news:e33xk5OREHA.3528@TK2MSFTNGP09.phx.gbl:
>
>
> Alan,
>
> There is no property in the RegularExpressionValidator control that
> allows regex options to be set.
>
> If your control does both client-side and server-side validation, the
> regex must use a subset of regular expression syntax that both
> JScript and .Net can execute. In this case, to make a regex ignore
> case it is necessary to use a character class construct like [a-zA-Z]
> to match both upper and lower case characters.
>
> If your validation is done on the server-side only, you can use the
> more powerful .Net regular expression syntax. In this case, you can
> place the (?i) option at the beginning of the regex to tell it to
> ignore case.
>
> --
> Hope this helps.
>
> Chris.
> -------------
> C.R. Timmons Consulting, Inc.
> http://www.crtimmonsinc.com/



Steven Cheng[MSFT]

2004-05-30, 10:39 pm

Thanks for Chris's informative suggestion.

Hi Alan,

I've also tested Chris's suggestion on use the (?i) flag before your
regex when using the serverside regex validation.
Be care that the flag is (?i) rather than ?i.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

A.M

2004-05-31, 9:48 am

Thank you Steven for hints.

"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:EUq6x8qREHA.1516@cpmsftngxa10.phx.gbl...
> Thanks for Chris's informative suggestion.
>
> Hi Alan,
>
> I've also tested Chris's suggestion on use the (?i) flag before your
> regex when using the serverside regex validation.
> Be care that the flag is (?i) rather than ?i.
>
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com