private static MatchDetailCollection Merge(MatchCollection collection, string input, MatchDetailCollection details) { if (details == null) { details = new MatchDetailCollection(); } var singles = (from Match item in collection select SelectSingle(item, input)); details.Merge(singles); return(details); }
public static IList <MatchDetail> Select(string input) { if (string.IsNullOrEmpty(input)) { return(null); } var yamlHeader = YamlHeaderRegex.Matches(input); if (yamlHeader.Count == 0) { return(null); } var details = new MatchDetailCollection(); var singles = (from Match item in yamlHeader select SelectSingle(item, input)); details.Merge(singles); return(details.Values.ToList()); }
public static IList <MatchDetail> Select(string input) { if (string.IsNullOrEmpty(input)) { return(null); } var codeSnippet = CodeSnippetRegex.Matches(input); if (codeSnippet.Count == 0) { return(null); } // For code snippet, id is the file path, should be case insensitive var details = new MatchDetailCollection(StringComparer.OrdinalIgnoreCase); var singles = (from Match item in codeSnippet select SelectSingle(item, input)); details.Merge(singles); return(details.Values.ToList()); }