Changeset 2006


Ignore:
Timestamp:
Oct 22, 2010, 7:56:46 PM (11 years ago)
Author:
Sven Rech
Message:

small regex fix for CostFunction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/CostFunction/CostFunction.cs

    r1869 r2006  
    6464        private IDictionary<int, IDictionary<string, double[]>> statistics;
    6565
     66        private Regex regularexpression = null;
     67
    6668        #endregion
    6769        #region internal constants
     
    405407        public double regex(string input)
    406408        {
    407             if (settings.RegEx == null)
    408             {
    409                 GuiLogMessage("There is no Regular Expression to be searched for. Please insert regex in the 'Regular Expression' - Textarea", NotificationLevel.Error);
    410                 return new Double();
    411             }
     409            if (regularexpression == null || regularexpression.ToString() != settings.RegEx)
     410            {
     411                if (settings.RegEx == null)
     412                {
     413                    GuiLogMessage("There is no Regular Expression to be searched for. Please insert regex in the 'Regular Expression' - Textarea", NotificationLevel.Error);
     414                    return new Double();
     415                }
     416                regularexpression = new Regex(settings.RegEx, RegexOptions.Compiled);
     417            }
     418
     419
    412420            try
    413421            {
    414                 Match match = Regex.Match(input, settings.RegEx);
     422                Match match = regularexpression.Match(input);
    415423                if (match.Success)
    416424                {
Note: See TracChangeset for help on using the changeset viewer.