protected override NodeResultBuilder GetValue() { var builder = new NodeResultBuilder(InputContents.Value); string suffix = ""; string prefix = ""; //Surround with non-capturing group if necessary if (InputContents.ConnectedNode is Node _node && RequiresGroupToQuantify(_node)) { prefix += "(?:"; suffix += ")"; } //Add quantifier suffix += GetSuffix( InputCount.Value, InputNumber.InputContents, InputMin.GetValue(), InputMax.GetValue()); //Add modifier if (InputCount.Value != Reps.Number) { if (InputSearchType.Value == SearchMode.Lazy) { suffix += "?"; } else if (InputSearchType.Value == SearchMode.Possessive) { suffix += ")"; prefix = "(?>" + prefix; } } builder.Prepend(prefix, this); builder.Append(suffix, this); return(builder); }
public override string GetValue() { string suffix = ""; //int min = InputMin.GetValue() ?? 0; //int? max = InputMax.GetValue(); switch (InputCount.DropdownValue) { case "Zero or more": suffix = "*"; break; case "One or more": suffix = "+"; break; case "Zero or one": suffix = "?"; break; case "Number": suffix = $"{{{InputNumber.InputContents}}}"; break; case "Range": int min = InputMin.GetValue() ?? 0; int?max = InputMax.GetValue(); suffix = $"{{{min},{max}}}"; break; } if (InputSearchType.DropdownValue == "Lazy") { suffix += "?"; } string contents = InputNode.GetValue(); if (!contents.IsSingleRegexChar()) { contents = contents.EnforceGrouped(); } string result = contents + suffix; return(UpdateCache(result)); }