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.

Introduction

Product: 

Class: 

Remarks

While you often match exact text (like matching the word "If" or "Select"), dynamic parsing requires matching categories of data, such as "any number" or "any string."

Syntax: {@Category}

  • Match Only: {@Alpha} matches any alphanumeric token but does not capture it into a variable.
  • Match & Capture: {@Alpha:myVar} matches an alphanumeric token and stores the value in {myVar}.
  • Not case sensitive: {@Number} and {@number} are equivalent.

Common Categories:

  • {@Alpha} (or {@Alphanumeric}): Matches words/identifiers (e.g., Result, x1).
  • {@Number}: Matches integers or decimals (e.g., 42, 3.14).
  • {@String}: Matches text inside quotes (e.g., "Hello", 'World').
  • {@Literal}: Matches any data value (Number OR String).

Comparative Analysis: Why uCalc?

  • vs. Regex (\d, \w):
    • Context: \w in Regex matches a single word character. {@Alpha} matches a complete token. This means {@Alpha} won't accidentally match the first letter of a string literal or a character inside a comment (if comments are filtered).
    • Simplicity: To match a quoted string in Regex, you need "[^"]*". In uCalc, it is simply {@String}. The parser handles the escape characters and quote boundaries for you.

Examples

Matching by token type

ID: 176

				
					using uCalcSoftware;

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

t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>");
t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>");
t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>");
t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>");
t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>");
t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>");
t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>");
t.FromTo("{@Reducible:r}", "<Reducible={r}>");
t.FromTo("{@Newline}", "<New line{@Newline}>");

var s = """
This is   55.2*6 "Hello world";
'Single quote'(parenth)
""";

Console.WriteLine(t.Filter(s).Matches.Text);
				
			
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)>
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

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

   t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>");
   t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>");
   t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>");
   t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>");
   t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>");
   t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>");
   t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>");
   t.FromTo("{@Reducible:r}", "<Reducible={r}>");
   t.FromTo("{@Newline}", "<New line{@Newline}>");

   auto s = R"(This is   55.2*6 "Hello world";
'Single quote'(parenth))";

   cout << t.Filter(s).Matches().Text() << endl;
}
				
			
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)>
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      
      t.FromTo("{@String:txt}", "<<InnerQuote={txt}><TxtWithQuotes={txt(0)}>>")
      t.FromTo("{@Number:MyNum}", "<NumericValue={MyNum}>")
      t.FromTo("{@Bracket:MyBrack}", "<Brack={MyBrack}>")
      t.FromTo("{@CloseBracket:CloseBr}", "<CloseBrack={CloseBr}>")
      t.FromTo("{@StatementSeparator:Sep}", "<Separator={Sep}>")
      t.FromTo("{@Alphanumeric:alpha}", "<Alpha={alpha}>")
      t.FromTo("{@Whitespace:ws}", "<whitespace count={@Eval: Length(ws)}>")
      t.FromTo("{@Reducible:r}", "<Reducible={r}>")
      t.FromTo("{@Newline}", "<New line{@Newline}>")
      
      Dim s = "This is   55.2*6 ""Hello world"";
'Single quote'(parenth)"
      
      Console.WriteLine(t.Filter(s).Matches.Text)
   End Sub
End Module
				
			
<Alpha=This>
<whitespace count=1>
<Alpha=is>
<whitespace count=3>
<NumericValue=55.2>
<Reducible=*>
<NumericValue=6>
<whitespace count=1>
<<InnerQuote=Hello world><TxtWithQuotes="Hello world">>
<Separator=;>
<New line
>
<<InnerQuote=Single quote><TxtWithQuotes='Single quote'>>
<Brack=(>
<Alpha=parenth>
<CloseBrack=)>
Displays the complete list of default token definitions, showing their type, internal name, and regex pattern.

ID: 70

				
					using uCalcSoftware;

var uc = new uCalc();
// Lists all tokens currently defined for the expression evaluator.

Console.WriteLine($"Token Count: {uc.ExpressionTokens.Count}");
Console.WriteLine("");
Console.WriteLine("Index  Type  Name: regex");
Console.WriteLine("========================");
var Tokens = uc.ExpressionTokens;
foreach(var token in Tokens) {
   Console.Write(Tokens.IndexOf(token));
   Console.WriteLine($"  {token.Description}  {token.Name}: {token.Regex}");
}

// Note that the expression evaluator token list has a few extra tokens,
// related to hex/bin/oct notation, string interpolation, and imaginary number
// notation, which are not found in the default Transformer token list.
				
			
Token Count: 30

Index  Type  Name: regex
========================
0  generic  _token_line: .*
1  generic  _token_catchall: .
2  generic  _token_catchall_utf8_other: [\xf0-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf][\x80-\xbf]|[\xc0-\xdf][\x80-\xbf]
3  generic  _token_punctuation: (--|\.{3}|\xE2\x80\xA6|[!"#$%&'()*+,\-./:;<=>?@\[\\\]^_`{|}~]|\xE2\x80[\x90-\x95])
4  generic  _token_quotechar: ("){3}|"|'
5  generic  _token_quotechar_single: '
6  generic  _token_quotechar_double: "
7  generic  _token_quotechar_tripledouble: """
8  memberaccess  _token_memberaccess: \.
9  generic  _token_variableargs: \.\.\.
10  reducible  _token_reducible2: [-:|+/*^&=%@!`\\<>?#$~]+
11  bracket  _token_parenthesis: \(
12  bracketclose  _token_parenthesis_close: \)
13  bracket  _token_curlybrace: \{
14  bracketclose  _token_curlybrace_close: \}
15  bracket  _token_squarebracket: \[
16  bracketclose  _token_squarebracket_close: \]
17  argseparator  _token_argseparator: ,
18  statementseparator  _token_newline: (?:\r?\n)|\r
19  statementseparator  _token_semicolon: ;
20  literal  _token_string_singlequoted: '([^']*(?:''[^']*)*)'
21  literal  _token_string_doublequoted: "([^"]*(?:""[^"]*)*)"
22  literal  _token_string_tripledoublequoted: """([\s\S]*?)"""
23  whitespace  _token_whitespace: [\t\v ]+
24  reducible  _token_reducible: [-:|+/*^&=%@!`\\<>?]+
25  literal  _token_floatnumber: [0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?
26  alphanumeric  _token_alphanumeric: [a-zA-Z_][a-zA-Z0-9_]*
27  literal  _token_imaginaryunit: #i
28  tokentransform  _token_binaryhexoctalnotation: #[bho][0-9A-F]+
29  tokentransform  _token_stringinterpolationquote: \$['"]
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Lists all tokens currently defined for the expression evaluator.

   cout << "Token Count: " << uc.ExpressionTokens().Count() << endl;
   cout << "" << endl;
   cout << "Index  Type  Name: regex" << endl;
   cout << "========================" << endl;
   auto Tokens = uc.ExpressionTokens();
   for(auto token : Tokens) {
      cout << Tokens.IndexOf(token);
      cout << "  " << token.Description() << "  " << token.Name() << ": " << token.Regex() << endl;
   }

   // Note that the expression evaluator token list has a few extra tokens,
   // related to hex/bin/oct notation, string interpolation, and imaginary number
   // notation, which are not found in the default Transformer token list.
}
				
			
Token Count: 30

Index  Type  Name: regex
========================
0  generic  _token_line: .*
1  generic  _token_catchall: .
2  generic  _token_catchall_utf8_other: [\xf0-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf][\x80-\xbf]|[\xc0-\xdf][\x80-\xbf]
3  generic  _token_punctuation: (--|\.{3}|\xE2\x80\xA6|[!"#$%&'()*+,\-./:;<=>?@\[\\\]^_`{|}~]|\xE2\x80[\x90-\x95])
4  generic  _token_quotechar: ("){3}|"|'
5  generic  _token_quotechar_single: '
6  generic  _token_quotechar_double: "
7  generic  _token_quotechar_tripledouble: """
8  memberaccess  _token_memberaccess: \.
9  generic  _token_variableargs: \.\.\.
10  reducible  _token_reducible2: [-:|+/*^&=%@!`\\<>?#$~]+
11  bracket  _token_parenthesis: \(
12  bracketclose  _token_parenthesis_close: \)
13  bracket  _token_curlybrace: \{
14  bracketclose  _token_curlybrace_close: \}
15  bracket  _token_squarebracket: \[
16  bracketclose  _token_squarebracket_close: \]
17  argseparator  _token_argseparator: ,
18  statementseparator  _token_newline: (?:\r?\n)|\r
19  statementseparator  _token_semicolon: ;
20  literal  _token_string_singlequoted: '([^']*(?:''[^']*)*)'
21  literal  _token_string_doublequoted: "([^"]*(?:""[^"]*)*)"
22  literal  _token_string_tripledoublequoted: """([\s\S]*?)"""
23  whitespace  _token_whitespace: [\t\v ]+
24  reducible  _token_reducible: [-:|+/*^&=%@!`\\<>?]+
25  literal  _token_floatnumber: [0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?
26  alphanumeric  _token_alphanumeric: [a-zA-Z_][a-zA-Z0-9_]*
27  literal  _token_imaginaryunit: #i
28  tokentransform  _token_binaryhexoctalnotation: #[bho][0-9A-F]+
29  tokentransform  _token_stringinterpolationquote: \$['"]
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Lists all tokens currently defined for the expression evaluator.
      
      Console.WriteLine($"Token Count: {uc.ExpressionTokens.Count}")
      Console.WriteLine("")
      Console.WriteLine("Index  Type  Name: regex")
      Console.WriteLine("========================")
      Dim Tokens = uc.ExpressionTokens
      For Each token In Tokens
         Console.Write(Tokens.IndexOf(token))
         Console.WriteLine($"  {token.Description}  {token.Name}: {token.Regex}")
      Next
      
      '// Note that the expression evaluator token list has a few extra tokens,
      '// related to hex/bin/oct notation, string interpolation, and imaginary number
      '// notation, which are not found in the default Transformer token list.
   End Sub
End Module
				
			
Token Count: 30

Index  Type  Name: regex
========================
0  generic  _token_line: .*
1  generic  _token_catchall: .
2  generic  _token_catchall_utf8_other: [\xf0-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf][\x80-\xbf]|[\xc0-\xdf][\x80-\xbf]
3  generic  _token_punctuation: (--|\.{3}|\xE2\x80\xA6|[!"#$%&'()*+,\-./:;<=>?@\[\\\]^_`{|}~]|\xE2\x80[\x90-\x95])
4  generic  _token_quotechar: ("){3}|"|'
5  generic  _token_quotechar_single: '
6  generic  _token_quotechar_double: "
7  generic  _token_quotechar_tripledouble: """
8  memberaccess  _token_memberaccess: \.
9  generic  _token_variableargs: \.\.\.
10  reducible  _token_reducible2: [-:|+/*^&=%@!`\\<>?#$~]+
11  bracket  _token_parenthesis: \(
12  bracketclose  _token_parenthesis_close: \)
13  bracket  _token_curlybrace: \{
14  bracketclose  _token_curlybrace_close: \}
15  bracket  _token_squarebracket: \[
16  bracketclose  _token_squarebracket_close: \]
17  argseparator  _token_argseparator: ,
18  statementseparator  _token_newline: (?:\r?\n)|\r
19  statementseparator  _token_semicolon: ;
20  literal  _token_string_singlequoted: '([^']*(?:''[^']*)*)'
21  literal  _token_string_doublequoted: "([^"]*(?:""[^"]*)*)"
22  literal  _token_string_tripledoublequoted: """([\s\S]*?)"""
23  whitespace  _token_whitespace: [\t\v ]+
24  reducible  _token_reducible: [-:|+/*^&=%@!`\\<>?]+
25  literal  _token_floatnumber: [0-9]*\.?[0-9]+([eE][+-]?[0-9]+)?
26  alphanumeric  _token_alphanumeric: [a-zA-Z_][a-zA-Z0-9_]*
27  literal  _token_imaginaryunit: #i
28  tokentransform  _token_binaryhexoctalnotation: #[bho][0-9A-F]+
29  tokentransform  _token_stringinterpolationquote: \$['"]
Simple arithmetic matching.

ID: 886

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
// Match "Number + Number"
t.FromTo("{@Number} + {@Number}", "Math Operation");

Console.WriteLine(t.Transform("10 + 20")); // Output: Math Operation
Console.WriteLine(t.Transform("A + B"));   // No Match (A/B are Alpha, not Number)
				
			
Math Operation
A + B
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   // Match "Number + Number"
   t.FromTo("{@Number} + {@Number}", "Math Operation");

   cout << t.Transform("10 + 20") << endl; // Output: Math Operation
   cout << t.Transform("A + B") << endl;   // No Match (A/B are Alpha, not Number)
}
				
			
Math Operation
A + B
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      '// Match "Number + Number"
      t.FromTo("{@Number} + {@Number}", "Math Operation")
      
      Console.WriteLine(t.Transform("10 + 20")) '// Output: Math Operation
      Console.WriteLine(t.Transform("A + B"))   '// No Match (A/B are Alpha, not Number)
   End Sub
End Module
				
			
Math Operation
A + B
Parsing Key-Value pairs where values can be numbers or strings.

ID: 887

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
// Use {@Literal} to match either numbers or strings
t.FromTo("{@Alpha:key} = {@Literal:val}", "Set {key} to {val}");

Console.WriteLine(t.Transform("Timeout = 100"));      // Output: Set Timeout to 100
Console.WriteLine(t.Transform("Name = 'Admin'"));     // Output: Set Name to 'Admin'
				
			
Set Timeout to 100
Set Name to 'Admin'
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   // Use {@Literal} to match either numbers or strings
   t.FromTo("{@Alpha:key} = {@Literal:val}", "Set {key} to {val}");

   cout << t.Transform("Timeout = 100") << endl;      // Output: Set Timeout to 100
   cout << t.Transform("Name = 'Admin'") << endl;     // Output: Set Name to 'Admin'
}
				
			
Set Timeout to 100
Set Name to 'Admin'
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      '// Use {@Literal} to match either numbers or strings
      t.FromTo("{@Alpha:key} = {@Literal:val}", "Set {key} to {val}")
      
      Console.WriteLine(t.Transform("Timeout = 100"))      '// Output: Set Timeout to 100
      Console.WriteLine(t.Transform("Name = 'Admin'"))     '// Output: Set Name to 'Admin'
   End Sub
End Module
				
			
Set Timeout to 100
Set Name to 'Admin'
(Default Matching) Identifying any brackets and normalizing them to a standard parentheses.

ID: 923

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@Bracket}", "(");
t.FromTo("{@CloseBracket}", ")");

Console.WriteLine(t.Transform("{a, b, c} f(x, y) [1, 2, 3];"));
				
			
(a, b, c) f(x, y) (1, 2, 3);
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.FromTo("{@Bracket}", "(");
   t.FromTo("{@CloseBracket}", ")");

   cout << t.Transform("{a, b, c} f(x, y) [1, 2, 3];") << endl;
}
				
			
(a, b, c) f(x, y) (1, 2, 3);
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.FromTo("{@Bracket}", "(")
      t.FromTo("{@CloseBracket}", ")")
      
      Console.WriteLine(t.Transform("{a, b, c} f(x, y) [1, 2, 3];"))
   End Sub
End Module
				
			
(a, b, c) f(x, y) (1, 2, 3);
{@Alphanumeric}

ID: 177

				
					using uCalcSoftware;

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

t.FromTo("({@Alphanumeric:txt})", "<Alpha str={txt}>");

Console.WriteLine(t.Transform("Testing 123 (456) (abc) ('text') (xyz111)"));
				
			
Testing 123 (456) <Alpha str=abc> ('text') <Alpha str=xyz111>
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

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

   t.FromTo("({@Alphanumeric:txt})", "<Alpha str={txt}>");

   cout << t.Transform("Testing 123 (456) (abc) ('text') (xyz111)") << endl;
}
				
			
Testing 123 (456) <Alpha str=abc> ('text') <Alpha str=xyz111>
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      
      t.FromTo("({@Alphanumeric:txt})", "<Alpha str={txt}>")
      
      Console.WriteLine(t.Transform("Testing 123 (456) (abc) ('text') (xyz111)"))
   End Sub
End Module
				
			
Testing 123 (456) <Alpha str=abc> ('text') <Alpha str=xyz111>
Extracting keys from a key-value list where keys must be identifiers.

ID: 250

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
// Capture the alphanumeric key and any literal value
t.FromTo("{@Alpha:key} = {@Literal:val}", "KEY:[{key}] VAL:[{val}]");

var input = "Timeout = 100; User = 'Admin'";
Console.WriteLine(t.Transform(input));
				
			
KEY:[Timeout] VAL:[100]; KEY:[User] VAL:['Admin']
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   // Capture the alphanumeric key and any literal value
   t.FromTo("{@Alpha:key} = {@Literal:val}", "KEY:[{key}] VAL:[{val}]");

   auto input = "Timeout = 100; User = 'Admin'";
   cout << t.Transform(input) << endl;
}
				
			
KEY:[Timeout] VAL:[100]; KEY:[User] VAL:['Admin']
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      '// Capture the alphanumeric key and any literal value
      t.FromTo("{@Alpha:key} = {@Literal:val}", "KEY:[{key}] VAL:[{val}]")
      
      Dim input = "Timeout = 100; User = 'Admin'"
      Console.WriteLine(t.Transform(input))
   End Sub
End Module
				
			
KEY:[Timeout] VAL:[100]; KEY:[User] VAL:['Admin']
(Real World: Escaping Helper) Finding double quotes to manually insert an escape backslash before them.

ID: 921

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@dq}", """
\"
""");

string input = """
He said "Hello"
""";
Console.WriteLine(t.Transform(input));
				
			
He said \"Hello\"
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.FromTo("{@dq}", R"(\")");

   string input = R"(He said "Hello")";
   cout << t.Transform(input) << endl;
}
				
			
He said \"Hello\"
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.FromTo("{@dq}", "\""")
      
      Dim input As String = "He said ""Hello"""
      Console.WriteLine(t.Transform(input))
   End Sub
End Module
				
			
He said \"Hello\"
(Real World: Value Masking)

ID: 915

				
					using uCalcSoftware;

var uc = new uCalc();
// Creating a "Clean View" of a log or configuration file by replacing all
// actual data values with a placeholder, leaving only the structural identifiers.
var t = new uCalc.Transformer();
// Replace every literal with a generic placeholder
t.FromTo("{@Literal}", "?");

string input = """
setting_a = 500; setting_b = "active";
""";
Console.WriteLine(t.Transform(input));
				
			
setting_a = ?; setting_b = ?;
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Creating a "Clean View" of a log or configuration file by replacing all
   // actual data values with a placeholder, leaving only the structural identifiers.
   uCalc::Transformer t;
   // Replace every literal with a generic placeholder
   t.FromTo("{@Literal}", "?");

   string input = R"(setting_a = 500; setting_b = "active";)";
   cout << t.Transform(input) << endl;
}
				
			
setting_a = ?; setting_b = ?;
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Creating a "Clean View" of a log or configuration file by replacing all
      '// actual data values with a placeholder, leaving only the structural identifiers.
      Dim t As New uCalc.Transformer()
      '// Replace every literal with a generic placeholder
      t.FromTo("{@Literal}", "?")
      
      Dim input As String = "setting_a = 500; setting_b = ""active"";"
      Console.WriteLine(t.Transform(input))
   End Sub
End Module
				
			
setting_a = ?; setting_b = ?;
Replacing all platform-specific newlines with a generic visible tag.

ID: 911

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@Newline}", "[BR]");

string input = "Line 1\nLine 2\r\nLine 3";

Console.WriteLine(t.Transform(input));
				
			
Line 1[BR]Line 2[BR]Line 3
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.FromTo("{@Newline}", "[BR]");

   string input = "Line 1\nLine 2\r\nLine 3";

   cout << t.Transform(input) << endl;
}
				
			
Line 1[BR]Line 2[BR]Line 3
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.FromTo("{@Newline}", "[BR]")
      
      
      Dim input = $"Line 1{vbLf}Line 2{vbCrLf}Line 3"
      Console.WriteLine(t.Transform(input))
   End Sub
End Module
				
			
Line 1[BR]Line 2[BR]Line 3
(Real World: Currency Formatter) Finding raw numbers in a text stream and converting them to a formatted currency string.

ID: 251

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("Price: {@Number:amt}", "Price: ${amt}");

string input = "Item A Price: 19.99, Item B Price: 5";
Console.WriteLine(t.Transform(input));
				
			
Item A Price: $19.99, Item B Price: $5
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   t.FromTo("Price: {@Number:amt}", "Price: ${amt}");

   string input = "Item A Price: 19.99, Item B Price: 5";
   cout << t.Transform(input) << endl;
}
				
			
Item A Price: $19.99, Item B Price: $5
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      t.FromTo("Price: {@Number:amt}", "Price: ${amt}")
      
      Dim input As String = "Item A Price: 19.99, Item B Price: 5"
      Console.WriteLine(t.Transform(input))
   End Sub
End Module
				
			
Item A Price: $19.99, Item B Price: $5
Identifying any quote character and replacing it with a visible tag.

ID: 906

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@QuoteChar}", "[Q]");

Console.WriteLine(t.Transform("""
"Double" and 'Single'
"""));
				
			
[Q]Double[Q] and [Q]Single[Q]
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.FromTo("{@QuoteChar}", "[Q]");

   cout << t.Transform(R"("Double" and 'Single')") << endl;
}
				
			
[Q]Double[Q] and [Q]Single[Q]
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.FromTo("{@QuoteChar}", "[Q]")
      
      Console.WriteLine(t.Transform("""Double"" and 'Single'"))
   End Sub
End Module
				
			
[Q]Double[Q] and [Q]Single[Q]
Identifying any operator sequence (single or multi-character) and labeling it.

ID: 903

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@Reducible:op}", "[OP:{op}]");
Console.WriteLine(t.Transform("a + b <= c"));
				
			
a [OP:+] b [OP:<=] c
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.FromTo("{@Reducible:op}", "[OP:{op}]");
   cout << t.Transform("a + b <= c") << endl;
}
				
			
a [OP:+] b [OP:<=] c
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.FromTo("{@Reducible:op}", "[OP:{op}]")
      Console.WriteLine(t.Transform("a + b <= c"))
   End Sub
End Module
				
			
a [OP:+] b [OP:<=] c
(Mixed Delimiter Check) Verifying that `{@sq}` captures only single quotes (ignoring double quotes).

ID: 902

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("{@sq}", "$");

// Only the single quote should be replaced
Console.WriteLine(t.Transform("""
"Hello" and 'World'
"""));
				
			
"Hello" and $World$
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   t.FromTo("{@sq}", "$");

   // Only the single quote should be replaced
   cout << t.Transform(R"("Hello" and 'World')") << endl;
}
				
			
"Hello" and $World$
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      t.FromTo("{@sq}", "$")
      
      '// Only the single quote should be replaced
      Console.WriteLine(t.Transform("""Hello"" and 'World'"))
   End Sub
End Module
				
			
"Hello" and $World$
{@StatementSeparator}

ID: 184

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("{@StatementSeparator}", "<sep>");
Console.WriteLine(t.Transform("a = b + c; x = y + 1;"));
				
			
a = b + c<sep> x = y + 1<sep>
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   t.FromTo("{@StatementSeparator}", "<sep>");
   cout << t.Transform("a = b + c; x = y + 1;") << endl;
}
				
			
a = b + c<sep> x = y + 1<sep>
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      t.FromTo("{@StatementSeparator}", "<sep>")
      Console.WriteLine(t.Transform("a = b + c; x = y + 1;"))
   End Sub
End Module
				
			
a = b + c<sep> x = y + 1<sep>
Demonstrating the difference between the `(0)` and `(1)` index.

ID: 894

				
					using uCalcSoftware;

var uc = new uCalc();
var t = new uCalc.Transformer();
// Capture the string and show both versions in the replacement
t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}");

Console.WriteLine(t.Transform("'uCalc'"));
				
			
With: 'uCalc', Without: uCalc, Default: uCalc
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uCalc::Transformer t;
   // Capture the string and show both versions in the replacement
   t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}");

   cout << t.Transform("'uCalc'") << endl;
}
				
			
With: 'uCalc', Without: uCalc, Default: uCalc
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      '// Capture the string and show both versions in the replacement
      t.FromTo("{@String:txt}", "With: {txt(0)}, Without: {txt(1)}, Default: {txt}")
      
      Console.WriteLine(t.Transform("'uCalc'"))
   End Sub
End Module
				
			
With: 'uCalc', Without: uCalc, Default: uCalc
{@Whitespace}

ID: 179

				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("{@Whitespace}", ",");

Console.WriteLine(t.Transform("This is   a 'small test' about ' whitespace ' tokens."));
				
			
This,is,a,'small test',about,' whitespace ',tokens.
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   t.FromTo("{@Whitespace}", ",");

   cout << t.Transform("This is   a 'small test' about ' whitespace ' tokens.") << endl;
}
				
			
This,is,a,'small test',about,' whitespace ',tokens.
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      t.FromTo("{@Whitespace}", ",")
      
      Console.WriteLine(t.Transform("This is   a 'small test' about ' whitespace ' tokens."))
   End Sub
End Module
				
			
This,is,a,'small test',about,' whitespace ',tokens.