public void Filter(CharCountCollection collection) { var regex = new Regex(collection.ToRegex(), RegexOptions.Multiline | RegexOptions.Compiled); var matches = regex.Matches(_wordlist); _list = matches .Select(m => m.Groups["word"].Value) .Distinct() .Where(collection.CanWordBeMade) .OrderByDescending(c => c.Length) .ToList(); }
public RegexFilterList(CharCountCollection collection, string wordlist) { _wordlist = wordlist; Filter(collection); }