using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Str("

Title

Bold statement

Title B

Other text

My paragraph

"); // ^ ^ ^ ^ ^ // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 // 0 10 20 30 40 50 60 70 80 // Carrets (^) point to Start locations of the matches var AnyOtherTag = t.Pattern("<{tag}>{text}"); var BoldTag = t.Pattern("{text}"); var H3Tag = t.Pattern("

{text}

"); t.Find(); Console.WriteLine("IndexOf StartPos Match"); Console.WriteLine(""); Console.WriteLine("All Matches"); Console.WriteLine("-----------"); foreach(var match in t.Matches) { Console.WriteLine($"{t.Matches.IndexOf(match.StartPosition)} {match.StartPosition} {match.Text}"); } Console.WriteLine(""); Console.WriteLine("Bold Matches"); Console.WriteLine("------------"); foreach(var BoldMatch in BoldTag.Matches) { Console.WriteLine($"{t.Matches.IndexOf(BoldMatch.StartPosition)} {BoldMatch.StartPosition} {BoldMatch.Text}"); } Console.WriteLine(""); Console.WriteLine("H3 Matches"); Console.WriteLine("----------"); foreach(var H3Match in H3Tag.Matches) { Console.WriteLine($"{t.Matches.IndexOf(H3Match.StartPosition)} {H3Match.StartPosition} {H3Match.Text}"); } Console.WriteLine(""); Console.WriteLine("Other Matches"); Console.WriteLine("-------------"); foreach(var AnyOtherMatch in AnyOtherTag.Matches) { Console.WriteLine($"{t.Matches.IndexOf(AnyOtherMatch.StartPosition)} {AnyOtherMatch.StartPosition} {AnyOtherMatch.Text}"); }