public RelatedMatch RelatedMatch(string text, int startIndex, TextLengthChanger owner = null) { var sw = Stopwatch.StartNew(); var match = _regex.Match(text, startIndex); Interlocked.Add(ref PerfomanceCounter, sw.ElapsedTicks); return(new RelatedMatch(match, owner)); }
public RelatedMatch(Match match, TextLengthChanger owner = null) { StartIndex = match.Index; Length = match.Length; Success = match.Success; Groups = match.Groups; if (owner != null) { SetOwner(owner); } }
public List <RelatedMatch> RelatedMatches(string text, TextLengthChanger owner = null) { var result = new List <RelatedMatch>(); var m = RelatedMatch(text, 0, owner); while (m.Success) { result.Add(m); m = RelatedMatch(text, m.StartIndex + m.Length, owner); } if (result.Count == 0) { result.Add(m); } return(result); }
public void SetOwner(TextLengthChanger owner) { _totalLegthCorrection = owner.TotalLegthCorrection; }