Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RegularExpressionValidator doesn't ignore case

Reply
Thread Tools

RegularExpressionValidator doesn't ignore case

 
 
A.M
Guest
Posts: n/a
 
      05-28-2004
Hi,

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

Thanks,
Alan


 
Reply With Quote
 
 
 
 
Chris R. Timmons
Guest
Posts: n/a
 
      05-29-2004
"A.M" <> wrote in
news::

> 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/
 
Reply With Quote
 
 
 
 
Ali.M
Guest
Posts: n/a
 
      05-29-2004
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:Xns94F7D1A488BEAcrtimmonscrtimmonsin@207.46.2 48.16...
> "A.M" <> wrote in
> news::
>
> > 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/



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-31-2004
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

 
Reply With Quote
 
A.M
Guest
Posts: n/a
 
      05-31-2004
Thank you Steven for hints.

"Steven Cheng[MSFT]" <v-> wrote in message
news:...
> 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
>



 
Reply With Quote
 
subha subha is offline
Junior Member
Join Date: Sep 2011
Posts: 1
 
      09-23-2011
try this code , it is working fine for me

<asp:RegularExpressionValidator ID="rgEmailLogin" runat="server"
ControlToValidate="txtUserNameLogin" ErrorMessage="Enter the valid email id"

ValidationExpression="^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
ValidationGroup="vgLoginGroup">*
</asp:RegularExpressionValidator>
 
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 Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using std::lexicographical_compare with ignore case equalitydoesn't always work Alex Buell C++ 18 12-30-2008 08:16 PM
Applet parameters - ignore case? Andrew Thompson Java 4 12-05-2008 02:19 AM
RegularExpressionValidator set case insensitive for both client and server ValidationExpression J055 ASP .Net 2 11-21-2007 08:54 AM
ignore case ValidationExpression in RegularExpressionValidator Morten71 ASP .Net 0 04-02-2007 12:28 PM
regarding ignore case sensitive of a string using regularexpressions Mosas Python 1 03-22-2005 12:49 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57