using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("this", "THAT"); string text = "transform this but not // this in a comment"; Console.WriteLine("--- Before --- "); // Initially, the comment is treated as regular text. Console.WriteLine(t.Transform(text)); // Add a token for C-style comments and classify it as whitespace. t.Tokens.Add("//.*", TokenType.Whitespace); Console.WriteLine(""); Console.WriteLine("--- After --- "); // Re-run the transform. The comment is now ignored. Console.WriteLine(t.Transform(text));