void Command_Text_ReverseRegEx(TextReverseRegExDialog.Result result) { if (Selections.Count != 1) { throw new Exception("Must have one selection."); } var data = RevRegExVisitor.Parse(result.RegEx, result.InfiniteCount); var output = data.GetPossibilities().Select(str => str + Data.DefaultEnding).ToList(); ReplaceSelections(string.Join("", output)); var start = Selections.Single().Start; var sels = new List <Range>(); foreach (var str in output) { sels.Add(Range.FromIndex(start, str.Length - Data.DefaultEnding.Length)); start += str.Length; } SetSelections(sels); }
void CalculateItems() { try { NumResults = RevRegExVisitor.Parse(RegEx, InfiniteCount).Count(); } catch { NumResults = null; } }