using uCalcSoftware; var uc = new uCalc(); // Get the transformer that pre-processes expressions. var t = uc.ExpressionTransformer; // Define a rule to find "X in to cm" and replace it with the calculated value. // Note: 'val' is captured as text and must be converted to a number with Double(). t.FromTo("{@Number:val} in to cm", "({@Eval: Double(val) * 2.54})"); // Use the new syntax directly in an expression. Console.WriteLine(uc.EvalStr("10 in to cm"));