/// <summary> /// Gets the highlight item of a found piece of text /// </summary> /// <param name="line">The line of text to match</param> /// <returns></returns> private bool GetFoundHighlightItem(ref HighlightedItem item) { HighlightItem special = new HighlightItem(this.SearchText, Constants.DEFAULT_FORECOLOUR, Constants.DEFAULT_BACKCOLOUR); if (!string.IsNullOrEmpty(special.Pattern) && !string.IsNullOrEmpty(item.Text)) { if (item.Text == special.Pattern || _patternMatching.MatchPattern(item.Text, special.Pattern)) { item.Selected = true; return(true); } else { item.Selected = false; return(false); } } return(false); }
public void PostCode_Pattern_Succesfully_Matched() { IStringPatternMatching pattern = OxTailLogic.PatternMatching.StringPatternMatching.CreatePatternMatching(); if (pattern.MatchPattern("B124TR", @"([a-zA-Z]{1,2}\w{1,2})+(\d{1}[a-zA-Z]{2})+")) { Assert.Pass(); } else { Assert.Fail(); } }