public void ItParsesGroups(string expression, bool found, int offset, int length) { var span = RegexParser.FirstGroup(expression); Assert.AreEqual(found, span != null); if (!found) { return; } Assert.AreEqual(offset, span.Value.Offset); Assert.AreEqual(length, span.Value.Length); }
internal static string ParseTitle(string title, IList <StatementParameter> parameters) { //Condition this to look a lot prettier title = title.StartsWith("^") ? title.Substring(1) : title; title = title.EndsWith("$") ? title.Substring(0, title.Length - 1) : title; title = title.Replace(@"\s+", " ").Replace(@"\s*", " ").ConsolidateWhitespace(); foreach (var param in parameters) { var span = RegexParser.FirstGroup(title); if (span == null) { break; } title = RegexParser.Replace(title, span.Value, "[" + param.Name + "]"); } return(title); }