using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); var logText = "ERROR: Fail 1. INFO: OK. ERROR: Fail 2. ERROR: Fail 3."; t.Text = logText; var errorRule = t.Pattern("ERROR: {msg}."); // Stop after finding the first error to focus on the initial problem. errorRule.StopAfter = 1; t.Find(); Console.WriteLine($"First error found: {t.Matches.Text}");