Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
480
Regular Expression Incorrect Evaluation in WPF Editors
posted

When I enter a value in XamDataGrid Editor cell which has regular Expression validation,  some values are not validated properly.

eg: “tester” is invalidated by regex “test|tester”.

       

I am using this assembly of yours “Infragistics3.Wpf.Editors.v10.1, Version=10.1.20101.1000” . A class called 'value constraint' seems to have a bug as follows:

 

 

    if (flag && this.ShouldTestConstraint(ValueConstraintFlags.RegexPattern, constraintFlags))

    {

        if (this._regex == null)

        {

            try

            {

                this._regex = new Regex(this.RegexPattern);

            }

            catch

            {

                return true;

            }

        }

        Match match = this._regex.Match(input);

        if ((!match.Success || (match.Index != 0)) || (match.Length != input.Length))   // Leads to incorrect validation. Eg: “tester” is invalidated by regex “test|tester”.

        {                                                                                                                      

            flag = false;

            errorMsg = SR.GetString("LMSG_ValueConstraint_RegexPattern");

        }

    }

 

Is there a work around to modify this behavior ?

Please guide me with the same.

Parents
No Data
Reply
  • 5600
    Offline posted

    Hi,

    Did you try to user the same regex but with \b(like this: =@"\b(test|tester)\b" ). 

    Regards

Children