using uCalcSoftware; var uc = new uCalc(); static void URLDecode(uCalc.Callback cb) { // In a real application, this would be a full URL decoding implementation. // For this example, we'll just handle spaces (%20) and plus signs (+). uCalc.String s = cb.ArgStr(1); s.Replace("%20", " ").Replace("+", " "); cb.ReturnStr(s.Text); } // 1. Define the custom URLDecode function in the uCalc engine uc.DefineFunction("URLDecode(s As String) As String", URLDecode); // 2. Create the transformer and configure its tokenizer using (var t = new uCalc.Transformer(uc)) { // Treat '&' as a statement separator to process each pair individually t.Tokens.Add("&", TokenType.StatementSep); // 3. Define the rule to capture key-value pairs and decode the value t.FromTo("{@Alphanumeric:key}={value}", "- {key}: '{@Eval: URLDecode(value)}'"); // 4. Process a real-world query string var queryString = "name=John%20Doe&role=user+admin&id=123"; // Use Filter() to get a clean, newline-separated list of the results Console.WriteLine(t.Transform(queryString).Matches); }