Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 void CalculateItems()
 {
     try { NumResults = RevRegExVisitor.Parse(RegEx, InfiniteCount).Count(); }
     catch { NumResults = null; }
 }