using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Pattern: Match "Log:", an optional level, and the message. // Replacement: Use `{!level:INFO}` to insert 'INFO' if {level} is empty. t.FromTo("Log: [{level: ERROR | WARN}] {msg}", "Status:{!level:INFO}{level} | Msg:{msg}"); // Case 1: Level is present Console.WriteLine(t.Transform("Log: ERROR File not found")); // Case 2: Level is missing, so the fallback is used Console.WriteLine(t.Transform("Log: System started successfully"));