RegularExpressionValidator doesn't ignore case

Discussion in 'ASP .Net' started by A.M, May 28, 2004.

  1. A.M

    A.M Guest

    Hi,

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

    Thanks,
    Alan
     
    A.M, May 28, 2004
    #1
    1. Advertising

  2. "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/
     
    Chris R. Timmons, May 29, 2004
    #2
    1. Advertising

  3. A.M

    Ali.M Guest

    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.248.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/
     
    Ali.M, May 29, 2004
    #3
  4. 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
     
    Steven Cheng[MSFT], May 31, 2004
    #4
  5. A.M

    A.M Guest

    Thank you Steven for hints.

    "Steven Cheng[MSFT]" <> 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
    >
     
    A.M, May 31, 2004
    #5
  6. A.M

    subha

    Joined:
    Sep 23, 2011
    Messages:
    1
    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>
     
    subha, Sep 23, 2011
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mosas
    Replies:
    1
    Views:
    438
    Maarten Sneep
    Mar 22, 2005
  2. Morten71
    Replies:
    0
    Views:
    667
    Morten71
    Apr 2, 2007
  3. J055
    Replies:
    2
    Views:
    3,325
  4. Replies:
    7
    Views:
    280
  5. Rob Meade
    Replies:
    6
    Views:
    300
    Rob Meade
    Mar 1, 2004
Loading...

Share This Page