uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

{@@...}

Product: 

Class: 

Remarks

Description: The syntax used to trigger engine-level logic dynamically at the moment a pattern match occurs, allowing the directive to use data captured during the match.

The @@ prefix is a modifier that shifts the execution of a directive from Rule Creation Time to Match Time. While a single-@ directive (like {@File}) is resolved once when the rule is defined, a double-@@ directive is resolved every single time the pattern finds a match in the source text.

Dynamic Resolution

Match-time directives are the key to building "intelligent" transformers. Because they execute during the transformation process, they have access to the local variables captured by the pattern match.

Common Match-Time Directives

  • {@@Eval:expr}: Evaluates an expression using captured data.
  • {@@File:var}: Loads a file whose name is determined by a captured variable.
  • {@@Define:var}: Dynamically sets a variable or function in the evaluator space based on the match.
  • {@@Exec:code}: Runs a procedure during the match without returning text.

Variable Syntax

When using variables captured in a pattern (e.g., {@Number:n}) within a {@@...} directive, do not use curly braces. The variable is already resident in the evaluator space for the duration of that specific match.

  • Correct: {@@Eval:n * 10}
  • Incorrect: {@@Eval:{n} * 10}

Examples

{@Eval}, {@@Eval}, and escaping special characters in a pattern
				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();

t.FromTo("'['{word}']'", "{@Eval: UCase(word)}");
t.FromTo("'{'{expr}'}'", "{@@Eval: expr}");

Console.WriteLine(t.Transform("Words like [this] and [that]."));
Console.WriteLine(t.Transform("Is {5*3} bigger than {5^3}?"));
				
			
Words like THIS and THAT.
Is 15 bigger than 125?
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();

   t.FromTo("'['{word}']'", "{@Eval: UCase(word)}");
   t.FromTo("'{'{expr}'}'", "{@@Eval: expr}");

   cout << t.Transform("Words like [this] and [that].") << endl;
   cout << t.Transform("Is {5*3} bigger than {5^3}?") << endl;
}
				
			
Words like THIS and THAT.
Is 15 bigger than 125?
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      
      t.FromTo("'['{word}']'", "{@Eval: UCase(word)}")
      t.FromTo("'{'{expr}'}'", "{@@Eval: expr}")
      
      Console.WriteLine(t.Transform("Words like [this] and [that]."))
      Console.WriteLine(t.Transform("Is {5*3} bigger than {5^3}?"))
   End Sub
End Module
				
			
Words like THIS and THAT.
Is 15 bigger than 125?