uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Description: A comprehensive guide to the functional syntax, logic directives, and structural anchors used to define and evaluate transformation rules in uCalc.
Pattern Methods are specialized instructions enclosed in { } that allow the uCalc Transformer to move beyond literal text matching. These methods interact with the uCalc engine to identify token categories, perform calculations, or even execute external logic during a transformation.
@ vs @@)The most powerful aspect of uCalc Pattern Methods is the ability to control when logic is executed using the @ prefix. This applies to almost all Directives:
| Syntax | Name | Timing | Behavior |
|---|---|---|---|
{@Method} | Static Directive | Rule Creation | Evaluated once when the rule is defined. Ideal for constant calculations or loading external templates. |
{@@Method} | Dynamic Directive | Match Time | Evaluated every time the pattern finds a match. Ideal for logic that depends on captured text. |
Directives perform actions. Note that variables captured in the pattern (e.g., {@Number:val}) are accessed by name without additional curly braces inside these directives.
{@Eval} / {@@Eval}: Evaluates an expression. Example: {@@Eval:val * 2}.{@File} / {@@File}: Inserts file content. Example: {@@File:filename} where filename is a captured variable.{@Define} / {@@Define}: Defines variables/functions in the uCalc evaluator space.{@Exec} / {@@Exec}: Executes code without returning a value to the pattern/replacement.{@Comment}: Annotates patterns; ignored during parsing (irrelevant to @/@@).These identify specific locations in the text stream:
{@Beginning}: Matches only if at the start of the source string.{@End}: Matches only if at the very end of the source string.{@All}: Captures the entire source string as a single entity.{@Stop}: Truncates the saved match at this specific point in the pattern.Reserved for the "To" part of a transformation:
{@Self}: The entire captured pattern.{@Doc}: The entire source document string.{@Param:n}: References a specific captured sub-part by number.Injects characters by ASCII code. {#65#66#67} results in ABC. Useful for non-printing characters like {#0} (Null) or {#10} (Line Feed).