private IEnumerable <PcreDfaMatchResult> MatchesIterator(string subject, PcreDfaMatchSettings settings) { using (var context = settings.CreateMatchContext(subject)) { var result = ExecuteDfaMatch(context); if (result.ResultCode != MatchResultCode.Success) { yield break; } var match = new PcreDfaMatchResult(result); yield return(match); while (true) { context.StartIndex = match.Index + 1; result = ExecuteDfaMatch(context); if (result.ResultCode != MatchResultCode.Success) { yield break; } match = new PcreDfaMatchResult(result); yield return(match); } } }
public IEnumerable <PcreDfaMatchResult> Matches(string subject, int startIndex) { var settings = new PcreDfaMatchSettings { StartIndex = startIndex }; return(Matches(subject, settings)); }
public PcreDfaMatchResult Match(string subject, int startIndex, PcreDfaMatchOptions options) { var settings = new PcreDfaMatchSettings { AdditionalOptions = options, StartIndex = startIndex }; return(Match(subject, settings)); }
public IEnumerable <PcreDfaMatchResult> Matches(string subject, PcreDfaMatchSettings settings) { if (subject == null) { throw new ArgumentNullException(nameof(subject)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (settings.StartIndex < 0 || settings.StartIndex > subject.Length) { throw new IndexOutOfRangeException("Invalid StartIndex value"); } return(MatchesIterator(subject, settings)); }
public PcreDfaMatchResult Match(string subject, PcreDfaMatchSettings settings) { if (subject == null) { throw new ArgumentNullException(nameof(subject)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (settings.StartIndex < 0 || settings.StartIndex > subject.Length) { throw new IndexOutOfRangeException("Invalid StartIndex value"); } return(_regex.DfaMatch(subject, settings, settings.StartIndex)); }
private IEnumerable <PcreDfaMatchResult> MatchesIterator(string subject, PcreDfaMatchSettings settings) { var match = _regex.DfaMatch(subject, settings, settings.StartIndex); if (!match.Success) { yield break; } yield return(match); while (true) { match = _regex.DfaMatch(subject, settings, match.Index + 1); if (!match.Success) { yield break; } yield return(match); } }
public PcreDfaMatchResult Match(string subject, PcreDfaMatchSettings settings) { if (subject == null) { throw new ArgumentNullException("subject"); } if (settings == null) { throw new ArgumentNullException("settings"); } if (settings.StartIndex < 0 || settings.StartIndex > subject.Length) { throw new IndexOutOfRangeException("Invalid StartIndex value"); } using (var context = settings.CreateMatchContext(subject)) { return(new PcreDfaMatchResult(ExecuteDfaMatch(context))); } }
private IEnumerable <PcreDfaMatchResult> MatchesIterator(string subject, PcreDfaMatchSettings settings) { var additionalOptions = ((PcreMatchOptions)settings.AdditionalOptions).ToPatternOptions(); var match = _regex.DfaMatch(subject, settings, settings.StartIndex, additionalOptions); if (!match.Success) { yield break; } yield return(match); additionalOptions |= PcreConstants.NO_UTF_CHECK; while (true) { var nextIndex = match.Index + 1; if (nextIndex > subject.Length) { yield break; } if (nextIndex < subject.Length && char.IsLowSurrogate(subject[nextIndex])) { ++nextIndex; } match = _regex.DfaMatch(subject, settings, nextIndex, additionalOptions); if (!match.Success) { yield break; } yield return(match); } }
public IEnumerable <PcreDfaMatchResult> Matches(string subject, int startIndex) => Matches(subject, PcreDfaMatchSettings.GetSettings(startIndex, PcreDfaMatchOptions.None));
public PcreDfaMatchResult Match(string subject, int startIndex, PcreDfaMatchOptions options) => Match(subject, PcreDfaMatchSettings.GetSettings(startIndex, options));