using uCalcSoftware; var uc = new uCalc(); using (var t = new uCalc.Transformer()) { var text_ok = "Header: OK"; var text_fail = "Header: ERROR"; // This rule only matches if the status is "OK" t.Pattern("Header: OK"); // Find() returns the transformer, so we can chain Matches().Count() if (t.SetText(text_ok).Find().Matches.Count() > 0) { Console.WriteLine("text_ok is valid."); } if (t.SetText(text_fail).Find().Matches.Count() == 0) { Console.WriteLine("text_fail is invalid."); } }