Ticket B145967
Visible to All Users

Regular Expression validation - support case insensitive pattern

created 15 years ago

The ASPxTextBox regular expression validator seems to be working incorrectly. Or maybe it's just a difference between JS and .NET.
Using the following regular expression in Expresso I can match the email address below, but it doesn't match in a web page.
Regex pattern: [A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}
Email address: strange-email-@hotmail.com
Note the hyphen right before the @ symbol.
I'm expecting the regex to ignore case because if I leave out the last hyphen the validation succeeds, so case seems to be ignored.

Comments (3)
DevExpress Support Team 15 years ago

    Hi Jonathan,

    Thank you for the report. I see the problem, and it appears because we create the RegEx object on the client side using the following code:

    JavaScript
    EvaluateIsValid: function(value) { if (value == null) return true; var strValue = value.toString(); if (_aspxTrim(strValue).length == 0) return true; var regEx = new RegExp(this.pattern); var matches = regEx.exec(strValue); return matches != null && strValue == matches[0]; }

    It is necessary to use another code to support case-insensitive regular expressions. I have exported your bug report to a suggestion and we will try to implement it in the future.
    Thanks,
    Plato

      OK, but ignoring case is just one part of the issue.
      Why is it that the regex pattern below succeeds with email address A, but fails with email address B?
      Pattern: [A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}
      A: strange-email@hotmail.com
      B: strange-email-@hotmail.com

      DevExpress Support Team 15 years ago

        Hi Jontathan,
        I've moved your question to the Regular Expression validation problem thread, as posting several questions in the same thread violates the Support Center concepts. Please create a new ticket in the Support Center every time you wish to ask a new question.
        Thanks,
        Plato

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.