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 structural category matcher that identifies any token defined as a line break or newline character sequence.
The {@Newline} directive (shorthand {@nl}) is used within a uCalc::Transformer to detect boundaries between lines. Because uCalc operates on tokens, {@Newline} is platform-agnostic; it will match whichever line-ending sequence (LF, CRLF, or custom separators) the engine is currently configured to recognize as a line break.
In many grammars, a newline acts as an implicit statement terminator. {@Newline} allows you to:
FromTo(), it matches an existing newline token in the input stream.FromTo(), it inserts the actual line-break character sequence defined in the engine's _newline variable.!The universal inversion operator ! can be applied to this directive:
{@Newline}: Matches a line break.{!Newline}: Matches any token that is not a line break.This is particularly effective when combined with {@Line} to create precise "horizontal" search patterns that strictly stay within the bounds of a single line.
ID: 176
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("{@String:txt}", "<>");
t.FromTo("{@Number:MyNum}", "");
t.FromTo("{@Bracket:MyBrack}", "");
t.FromTo("{@CloseBracket:CloseBr}", "");
t.FromTo("{@StatementSeparator:Sep}", "");
t.FromTo("{@Alphanumeric:alpha}", "");
t.FromTo("{@Whitespace:ws}", "");
t.FromTo("{@Reducible:r}", "");
t.FromTo("{@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=)> 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);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("{@String:txt}", "<>");
t.FromTo("{@Number:MyNum}", "");
t.FromTo("{@Bracket:MyBrack}", "");
t.FromTo("{@CloseBracket:CloseBr}", "");
t.FromTo("{@StatementSeparator:Sep}", "");
t.FromTo("{@Alphanumeric:alpha}", "");
t.FromTo("{@Whitespace:ws}", "");
t.FromTo("{@Reducible:r}", "");
t.FromTo("{@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=)> #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; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("{@String:txt}", "<>")
t.FromTo("{@Number:MyNum}", "")
t.FromTo("{@Bracket:MyBrack}", "")
t.FromTo("{@CloseBracket:CloseBr}", "")
t.FromTo("{@StatementSeparator:Sep}", "")
t.FromTo("{@Alphanumeric:alpha}", "")
t.FromTo("{@Whitespace:ws}", "")
t.FromTo("{@Reducible:r}", "")
t.FromTo("{@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=)> 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
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 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));
#include
#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 #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; }
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 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
ID: 912
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Match two newlines in a row and replace with one
t.FromTo("{@nl} {@nl}", "{@nl}"); // {@nl} same as {@NewLine}
string text = "First\n\nSecond\n\nThird";
Console.WriteLine(t.Transform(text));
First
Second
Third using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Match two newlines in a row and replace with one t.FromTo("{@nl} {@nl}", "{@nl}"); // {@nl} same as {@NewLine} string text = "First\n\nSecond\n\nThird"; Console.WriteLine(t.Transform(text));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Match two newlines in a row and replace with one
t.FromTo("{@nl} {@nl}", "{@nl}"); // {@nl} same as {@NewLine}
string text = "First\n\nSecond\n\nThird";
cout << t.Transform(text) << endl;
}
First
Second
Third #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Match two newlines in a row and replace with one t.FromTo("{@nl} {@nl}", "{@nl}"); // {@nl} same as {@NewLine} string text = "First\n\nSecond\n\nThird"; cout << t.Transform(text) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Match two newlines in a row and replace with one
t.FromTo("{@nl} {@nl}", "{@nl}") '// {@nl} same as {@NewLine}
Dim text = $"First{vbLf}{vbLf}Second{vbLf}{vbLf}Third"
Console.WriteLine(t.Transform(text))
End Sub
End Module
First
Second
Third Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Match two newlines in a row and replace with one t.FromTo("{@nl} {@nl}", "{@nl}") '// {@nl} same as {@NewLine} Dim text = $"First{vbLf}{vbLf}Second{vbLf}{vbLf}Third" Console.WriteLine(t.Transform(text)) End Sub End Module