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.
Product:
Class:
Gets or sets a user-defined text description for a Transformer rule, useful for attaching metadata and for debugging.
The Description property provides a way to attach arbitrary string metadata to a Transformer Rule. This is invaluable for debugging, creating self-documenting configurations, and identifying which rule generated a specific Match at runtime.
This property functions as both a getter and a setter:
myRule.Description returns the current description of the rule. If no description has been set, it returns an empty string.myRule.Description = "your text" sets the rule's description. The setter supports a fluent interface, meaning it returns the Rule object itself, allowing you to chain method calls.Without an integrated Description property, developers often resort to less ideal solutions for tracking metadata:
Dictionary<Rule, string> is cumbersome. It requires manual synchronization, and if a Rule is released, the dictionary entry can become a memory leak.uCalc's approach is superior because the metadata is tightly coupled with the object itself and is consistently available across the object model. This creates a unified, easy-to-use system for runtime introspection.
ID: 871
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
var myRule = t.FromTo("Hello", "Hi");
myRule.Description = "Simple greeting replacement";
Console.WriteLine($"Rule Pattern: {myRule.Pattern}");
Console.Write("Rule Description: "); Console.Write(myRule.Description);
Rule Pattern: Hello
Rule Description: Simple greeting replacement using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); var myRule = t.FromTo("Hello", "Hi"); myRule.Description = "Simple greeting replacement"; Console.WriteLine($"Rule Pattern: {myRule.Pattern}"); Console.Write("Rule Description: "); Console.Write(myRule.Description);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
auto myRule = t.FromTo("Hello", "Hi");
myRule.Description("Simple greeting replacement");
cout << "Rule Pattern: " << myRule.Pattern() << endl;
cout << "Rule Description: " << myRule.Description();
}
Rule Pattern: Hello
Rule Description: Simple greeting replacement #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); auto myRule = t.FromTo("Hello", "Hi"); myRule.Description("Simple greeting replacement"); cout << "Rule Pattern: " << myRule.Pattern() << endl; cout << "Rule Description: " << myRule.Description(); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
Dim myRule = t.FromTo("Hello", "Hi")
myRule.Description = "Simple greeting replacement"
Console.WriteLine($"Rule Pattern: {myRule.Pattern}")
Console.Write("Rule Description: ")
Console.Write(myRule.Description)
End Sub
End Module
Rule Pattern: Hello
Rule Description: Simple greeting replacement Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() Dim myRule = t.FromTo("Hello", "Hi") myRule.Description = "Simple greeting replacement" Console.WriteLine($"Rule Pattern: {myRule.Pattern}") Console.Write("Rule Description: ") Console.Write(myRule.Description) End Sub End Module
ID: 118
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Str("Title
Bold statementTitle B
Other textMy paragraph
");
var AnyOtherTag = t.Pattern("<{tag}>{text}{tag}>").SetDescription("other kind of tag");
var BoldTag = t.Pattern("{text}").SetDescription("bold tag");
var H3Tag = t.Pattern("{text}
").SetDescription("h3 tag");
t.Find();
foreach(var match in t.Matches) {
Console.WriteLine(match.Text + " Description: " + match.Rule.Description);
}
<h3>Title</h3> Description: h3 tag
<b>Bold statement</b> Description: bold tag
<h3>Title B</h3> Description: h3 tag
<b>Other text</b> Description: bold tag
<p>My paragraph</p> Description: other kind of tag using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Str("<h3>Title</h3><b>Bold statement</b><h3>Title B</h3><b>Other text</b><p>My paragraph</p>"); var AnyOtherTag = t.Pattern("<{tag}>{text}</{tag}>").SetDescription("other kind of tag"); var BoldTag = t.Pattern("<b>{text}</b>").SetDescription("bold tag"); var H3Tag = t.Pattern("<h3>{text}</h3>").SetDescription("h3 tag"); t.Find(); foreach(var match in t.Matches) { Console.WriteLine(match.Text + " Description: " + match.Rule.Description); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Str("Title
Bold statementTitle B
Other textMy paragraph
");
auto AnyOtherTag = t.Pattern("<{tag}>{text}{tag}>").SetDescription("other kind of tag");
auto BoldTag = t.Pattern("{text}").SetDescription("bold tag");
auto H3Tag = t.Pattern("{text}
").SetDescription("h3 tag");
t.Find();
for(auto match : t.Matches()) {
cout << match.Text() + " Description: " + match.Rule().Description() << endl;
}
}
<h3>Title</h3> Description: h3 tag
<b>Bold statement</b> Description: bold tag
<h3>Title B</h3> Description: h3 tag
<b>Other text</b> Description: bold tag
<p>My paragraph</p> Description: other kind of tag #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Str("<h3>Title</h3><b>Bold statement</b><h3>Title B</h3><b>Other text</b><p>My paragraph</p>"); auto AnyOtherTag = t.Pattern("<{tag}>{text}</{tag}>").SetDescription("other kind of tag"); auto BoldTag = t.Pattern("<b>{text}</b>").SetDescription("bold tag"); auto H3Tag = t.Pattern("<h3>{text}</h3>").SetDescription("h3 tag"); t.Find(); for(auto match : t.Matches()) { cout << match.Text() + " Description: " + match.Rule().Description() << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Str("Title
Bold statementTitle B
Other textMy paragraph
")
Dim AnyOtherTag = t.Pattern("<{tag}>{text}{tag}>").SetDescription("other kind of tag")
Dim BoldTag = t.Pattern("{text}").SetDescription("bold tag")
Dim H3Tag = t.Pattern("{text}
").SetDescription("h3 tag")
t.Find()
For Each match In t.Matches
Console.WriteLine(match.Text + " Description: " + match.Rule.Description)
Next
End Sub
End Module
<h3>Title</h3> Description: h3 tag
<b>Bold statement</b> Description: bold tag
<h3>Title B</h3> Description: h3 tag
<b>Other text</b> Description: bold tag
<p>My paragraph</p> Description: other kind of tag Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Str("<h3>Title</h3><b>Bold statement</b><h3>Title B</h3><b>Other text</b><p>My paragraph</p>") Dim AnyOtherTag = t.Pattern("<{tag}>{text}</{tag}>").SetDescription("other kind of tag") Dim BoldTag = t.Pattern("<b>{text}</b>").SetDescription("bold tag") Dim H3Tag = t.Pattern("<h3>{text}</h3>").SetDescription("h3 tag") t.Find() For Each match In t.Matches Console.WriteLine(match.Text + " Description: " + match.Rule.Description) Next End Sub End Module