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.
StartAfter = [int]
Property
Product:
Class:
Gets or sets the number of matches a rule must find and ignore before it starts including subsequent matches in the results.
Remarks
🎯 Skipping Initial Matches: StartAfter
The StartAfter property sets a zero-based offset for a rule's results, instructing the Transformer to find and discard a specified number of initial matches before including any subsequent matches in the final collection. This is a powerful tool for pagination, skipping headers, or ignoring a known number of preliminary patterns.
The default value is 0, meaning no matches are skipped.
⚙️ Getter and Setter Behavior
This property functions as both a getter and a setter:
- Getter:
var offset = myRule.StartAfter;Returns the current number of matches to be skipped. - Setter:
myRule.StartAfter = 2;property orSetStartAfter()method.Sets the number of matches to skip. This method supports a fluent interface, returning the Rule object to allow for method chaining.
StartAfter vs. StopAfter vs. Minimum
Choosing the correct property to limit matches is crucial. This table clarifies their distinct behaviors:
| Property | Behavior | Use Case |
|---|---|---|
@StartAfter(n) (This Property) | Skips the first n matches and keeps the rest. | Skipping a known number of initial items (like a header). |
@StopAfter(n) | Keeps the first n matches and discards the rest. | Limiting a search to the first few occurrences of a pattern. |
@Minimum(n) | Validates. If fewer than n matches are found, all matches for this rule are discarded. | Ensuring a pattern appears a certain number of times to be valid. |
💡 Why uCalc? (Comparative Analysis)
In a standard data processing workflow, like using LINQ in C#, you would achieve this imperatively:
// C# LINQ examplevar resultsToProcess = allMatches.Skip(2);This approach requires you to first collect all possible matches and then filter them in your application code.
uCalc's @StartAfter is declarative. You state the requirement directly on the Rule, and the engine handles the logic internally. This can be more efficient, as the engine can potentially discard the skipped matches as it finds them, reducing the memory overhead of storing a complete match list before filtering.
Examples
A succinct example that finds all occurrences of a letter but skips the first one.
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.Text = "a b c a d e a f g";
var ruleA = t.FromTo("a", "[MATCH]");
// Skip the first 'a' that is found
ruleA.StartAfter = 1;
Console.WriteLine(t.Transform());
a b c [MATCH] d e [MATCH] f g using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.Text = "a b c a d e a f g"; var ruleA = t.FromTo("a", "[MATCH]"); // Skip the first 'a' that is found ruleA.StartAfter = 1; Console.WriteLine(t.Transform());
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.Text("a b c a d e a f g");
auto ruleA = t.FromTo("a", "[MATCH]");
// Skip the first 'a' that is found
ruleA.StartAfter(1);
cout << t.Transform() << endl;
}
a b c [MATCH] d e [MATCH] f g #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.Text("a b c a d e a f g"); auto ruleA = t.FromTo("a", "[MATCH]"); // Skip the first 'a' that is found ruleA.StartAfter(1); cout << t.Transform() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.Text = "a b c a d e a f g"
Dim ruleA = t.FromTo("a", "[MATCH]")
'// Skip the first 'a' that is found
ruleA.StartAfter = 1
Console.WriteLine(t.Transform())
End Sub
End Module
a b c [MATCH] d e [MATCH] f g Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.Text = "a b c a d e a f g" Dim ruleA = t.FromTo("a", "[MATCH]") '// Skip the first 'a' that is found ruleA.StartAfter = 1 Console.WriteLine(t.Transform()) End Sub End Module
A practical example that processes a list of tasks but skips the first two high-priority items.
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
var taskList = "Task:1 Task:2 Task:3 Task:4 Task:5";
t.Text = taskList;
var taskRule = t.FromTo("Task:{@Number:id}", "Processed Task {id}");
// Skip the first two tasks in the list
taskRule.StartAfter = 2;
Console.WriteLine(t.Transform());
Task:1 Task:2 Processed Task 3 Processed Task 4 Processed Task 5 using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); var taskList = "Task:1 Task:2 Task:3 Task:4 Task:5"; t.Text = taskList; var taskRule = t.FromTo("Task:{@Number:id}", "Processed Task {id}"); // Skip the first two tasks in the list taskRule.StartAfter = 2; Console.WriteLine(t.Transform());
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
auto taskList = "Task:1 Task:2 Task:3 Task:4 Task:5";
t.Text(taskList);
auto taskRule = t.FromTo("Task:{@Number:id}", "Processed Task {id}");
// Skip the first two tasks in the list
taskRule.StartAfter(2);
cout << t.Transform() << endl;
}
Task:1 Task:2 Processed Task 3 Processed Task 4 Processed Task 5 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; auto taskList = "Task:1 Task:2 Task:3 Task:4 Task:5"; t.Text(taskList); auto taskRule = t.FromTo("Task:{@Number:id}", "Processed Task {id}"); // Skip the first two tasks in the list taskRule.StartAfter(2); cout << t.Transform() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
Dim taskList = "Task:1 Task:2 Task:3 Task:4 Task:5"
t.Text = taskList
Dim taskRule = t.FromTo("Task:{@Number:id}", "Processed Task {id}")
'// Skip the first two tasks in the list
taskRule.StartAfter = 2
Console.WriteLine(t.Transform())
End Sub
End Module
Task:1 Task:2 Processed Task 3 Processed Task 4 Processed Task 5 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() Dim taskList = "Task:1 Task:2 Task:3 Task:4 Task:5" t.Text = taskList Dim taskRule = t.FromTo("Task:{@Number:id}", "Processed Task {id}") '// Skip the first two tasks in the list taskRule.StartAfter = 2 Console.WriteLine(t.Transform()) End Sub End Module
Rule StartAfter()
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
var FruitsXML =
"""
""";
var Fruit = t.FromTo("CommonName={@string:name}", "{name}");
// StopAfter()
Fruit.StopAfter = 4;
t.Filter(FruitsXML);
Console.WriteLine($"*** Stop after: {Fruit.StopAfter} ***");
Console.WriteLine(t.Matches.Text);
Fruit.StopAfter = -1; // Resets back to infinity (default) for next example
Console.WriteLine("");
// StartAfter()
Fruit.StartAfter = 6;
t.Filter(FruitsXML);
Console.WriteLine($"*** Start after: {Fruit.StartAfter} ***");
Console.WriteLine(t.Matches.Text);
Fruit.StartAfter = 0; // Resets back to 0 (default) for next example
Console.WriteLine("");
// Both StartAfter() and StopAfter()
Fruit.SetStartAfter(2).SetStopAfter(5);
t.Filter(FruitsXML);
Console.WriteLine($"*** Between {Fruit.StartAfter + 1} and {Fruit.StopAfter} ***");
Console.WriteLine(t.Matches.Text);
Console.WriteLine("");
// All
uc.DefineVariable("x = 1");
Fruit = t.FromTo("CommonName={@string:name}", "{@Eval: x++}. {name}");
t.Filter(FruitsXML);
Console.WriteLine("*** All ***");
Console.WriteLine(t.Matches.Text);
*** Stop after: 4 ***
Apple
Banana
Orange
Grapes
*** Start after: 6 ***
Mango
Blueberry
Rambutan
Salak (Snake Fruit)
Jabuticaba
Watermelon
*** Between 3 and 5 ***
Orange
Grapes
Strawberry
*** All ***
1. Apple
2. Banana
3. Orange
4. Grapes
5. Strawberry
6. Pineapple
7. Mango
8. Blueberry
9. Rambutan
10. Salak (Snake Fruit)
11. Jabuticaba
12. Watermelon using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); var FruitsXML = """ <Fruits> <Fruit CommonName='Apple' ScientificName='Malus domestica' /> <Fruit CommonName='Banana' ScientificName='Musa acuminata' /> <Fruit CommonName='Orange' ScientificName='Citrus × sinensis' /> <Fruit CommonName='Grapes' ScientificName='Vitis vinifera' /> <Fruit CommonName='Strawberry' ScientificName='Fragaria × ananassa' /> <Fruit CommonName='Pineapple' ScientificName='Ananas comosus' /> <Fruit CommonName='Mango' ScientificName='Mangifera indica' /> <Fruit CommonName='Blueberry' ScientificName='Vaccinium corymbosum' /> <Fruit CommonName='Rambutan' ScientificName='Nephelium lappaceum' /> <Fruit CommonName='Salak (Snake Fruit)' ScientificName='Salacca zalacca' /> <Fruit CommonName='Jabuticaba' ScientificName='Plinia cauliflora' /> <Fruit CommonName='Watermelon' ScientificName='Citrullus lanatus' /> </Fruits> """; var Fruit = t.FromTo("CommonName={@string:name}", "{name}"); // StopAfter() Fruit.StopAfter = 4; t.Filter(FruitsXML); Console.WriteLine($"*** Stop after: {Fruit.StopAfter} ***"); Console.WriteLine(t.Matches.Text); Fruit.StopAfter = -1; // Resets back to infinity (default) for next example Console.WriteLine(""); // StartAfter() Fruit.StartAfter = 6; t.Filter(FruitsXML); Console.WriteLine($"*** Start after: {Fruit.StartAfter} ***"); Console.WriteLine(t.Matches.Text); Fruit.StartAfter = 0; // Resets back to 0 (default) for next example Console.WriteLine(""); // Both StartAfter() and StopAfter() Fruit.SetStartAfter(2).SetStopAfter(5); t.Filter(FruitsXML); Console.WriteLine($"*** Between {Fruit.StartAfter + 1} and {Fruit.StopAfter} ***"); Console.WriteLine(t.Matches.Text); Console.WriteLine(""); // All uc.DefineVariable("x = 1"); Fruit = t.FromTo("CommonName={@string:name}", "{@Eval: x++}. {name}"); t.Filter(FruitsXML); Console.WriteLine("*** All ***"); Console.WriteLine(t.Matches.Text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
auto FruitsXML =
R"(
)";
auto Fruit = t.FromTo("CommonName={@string:name}", "{name}");
// StopAfter()
Fruit.StopAfter(4);
t.Filter(FruitsXML);
cout << "*** Stop after: " << Fruit.StopAfter() << " ***" << endl;
cout << t.Matches().Text() << endl;
Fruit.StopAfter(-1); // Resets back to infinity (default) for next example
cout << "" << endl;
// StartAfter()
Fruit.StartAfter(6);
t.Filter(FruitsXML);
cout << "*** Start after: " << Fruit.StartAfter() << " ***" << endl;
cout << t.Matches().Text() << endl;
Fruit.StartAfter(0); // Resets back to 0 (default) for next example
cout << "" << endl;
// Both StartAfter() and StopAfter()
Fruit.SetStartAfter(2).SetStopAfter(5);
t.Filter(FruitsXML);
cout << "*** Between " << Fruit.StartAfter() + 1 << " and " << Fruit.StopAfter() << " ***" << endl;
cout << t.Matches().Text() << endl;
cout << "" << endl;
// All
uc.DefineVariable("x = 1");
Fruit = t.FromTo("CommonName={@string:name}", "{@Eval: x++}. {name}");
t.Filter(FruitsXML);
cout << "*** All ***" << endl;
cout << t.Matches().Text() << endl;
}
*** Stop after: 4 ***
Apple
Banana
Orange
Grapes
*** Start after: 6 ***
Mango
Blueberry
Rambutan
Salak (Snake Fruit)
Jabuticaba
Watermelon
*** Between 3 and 5 ***
Orange
Grapes
Strawberry
*** All ***
1. Apple
2. Banana
3. Orange
4. Grapes
5. Strawberry
6. Pineapple
7. Mango
8. Blueberry
9. Rambutan
10. Salak (Snake Fruit)
11. Jabuticaba
12. Watermelon #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); auto FruitsXML = R"( <Fruits> <Fruit CommonName='Apple' ScientificName='Malus domestica' /> <Fruit CommonName='Banana' ScientificName='Musa acuminata' /> <Fruit CommonName='Orange' ScientificName='Citrus × sinensis' /> <Fruit CommonName='Grapes' ScientificName='Vitis vinifera' /> <Fruit CommonName='Strawberry' ScientificName='Fragaria × ananassa' /> <Fruit CommonName='Pineapple' ScientificName='Ananas comosus' /> <Fruit CommonName='Mango' ScientificName='Mangifera indica' /> <Fruit CommonName='Blueberry' ScientificName='Vaccinium corymbosum' /> <Fruit CommonName='Rambutan' ScientificName='Nephelium lappaceum' /> <Fruit CommonName='Salak (Snake Fruit)' ScientificName='Salacca zalacca' /> <Fruit CommonName='Jabuticaba' ScientificName='Plinia cauliflora' /> <Fruit CommonName='Watermelon' ScientificName='Citrullus lanatus' /> </Fruits> )"; auto Fruit = t.FromTo("CommonName={@string:name}", "{name}"); // StopAfter() Fruit.StopAfter(4); t.Filter(FruitsXML); cout << "*** Stop after: " << Fruit.StopAfter() << " ***" << endl; cout << t.Matches().Text() << endl; Fruit.StopAfter(-1); // Resets back to infinity (default) for next example cout << "" << endl; // StartAfter() Fruit.StartAfter(6); t.Filter(FruitsXML); cout << "*** Start after: " << Fruit.StartAfter() << " ***" << endl; cout << t.Matches().Text() << endl; Fruit.StartAfter(0); // Resets back to 0 (default) for next example cout << "" << endl; // Both StartAfter() and StopAfter() Fruit.SetStartAfter(2).SetStopAfter(5); t.Filter(FruitsXML); cout << "*** Between " << Fruit.StartAfter() + 1 << " and " << Fruit.StopAfter() << " ***" << endl; cout << t.Matches().Text() << endl; cout << "" << endl; // All uc.DefineVariable("x = 1"); Fruit = t.FromTo("CommonName={@string:name}", "{@Eval: x++}. {name}"); t.Filter(FruitsXML); cout << "*** All ***" << endl; cout << t.Matches().Text() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
Dim FruitsXML =
"
"
Dim Fruit = t.FromTo("CommonName={@string:name}", "{name}")
'// StopAfter()
Fruit.StopAfter = 4
t.Filter(FruitsXML)
Console.WriteLine($"*** Stop after: {Fruit.StopAfter} ***")
Console.WriteLine(t.Matches.Text)
Fruit.StopAfter = -1 '// Resets back to infinity (default) for next example
Console.WriteLine("")
'// StartAfter()
Fruit.StartAfter = 6
t.Filter(FruitsXML)
Console.WriteLine($"*** Start after: {Fruit.StartAfter} ***")
Console.WriteLine(t.Matches.Text)
Fruit.StartAfter = 0 '// Resets back to 0 (default) for next example
Console.WriteLine("")
'// Both StartAfter() and StopAfter()
Fruit.SetStartAfter(2).SetStopAfter(5)
t.Filter(FruitsXML)
Console.WriteLine($"*** Between {Fruit.StartAfter + 1} and {Fruit.StopAfter} ***")
Console.WriteLine(t.Matches.Text)
Console.WriteLine("")
'// All
uc.DefineVariable("x = 1")
Fruit = t.FromTo("CommonName={@string:name}", "{@Eval: x++}. {name}")
t.Filter(FruitsXML)
Console.WriteLine("*** All ***")
Console.WriteLine(t.Matches.Text)
End Sub
End Module
*** Stop after: 4 ***
Apple
Banana
Orange
Grapes
*** Start after: 6 ***
Mango
Blueberry
Rambutan
Salak (Snake Fruit)
Jabuticaba
Watermelon
*** Between 3 and 5 ***
Orange
Grapes
Strawberry
*** All ***
1. Apple
2. Banana
3. Orange
4. Grapes
5. Strawberry
6. Pineapple
7. Mango
8. Blueberry
9. Rambutan
10. Salak (Snake Fruit)
11. Jabuticaba
12. Watermelon Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() Dim FruitsXML = " <Fruits> <Fruit CommonName='Apple' ScientificName='Malus domestica' /> <Fruit CommonName='Banana' ScientificName='Musa acuminata' /> <Fruit CommonName='Orange' ScientificName='Citrus × sinensis' /> <Fruit CommonName='Grapes' ScientificName='Vitis vinifera' /> <Fruit CommonName='Strawberry' ScientificName='Fragaria × ananassa' /> <Fruit CommonName='Pineapple' ScientificName='Ananas comosus' /> <Fruit CommonName='Mango' ScientificName='Mangifera indica' /> <Fruit CommonName='Blueberry' ScientificName='Vaccinium corymbosum' /> <Fruit CommonName='Rambutan' ScientificName='Nephelium lappaceum' /> <Fruit CommonName='Salak (Snake Fruit)' ScientificName='Salacca zalacca' /> <Fruit CommonName='Jabuticaba' ScientificName='Plinia cauliflora' /> <Fruit CommonName='Watermelon' ScientificName='Citrullus lanatus' /> </Fruits> " Dim Fruit = t.FromTo("CommonName={@string:name}", "{name}") '// StopAfter() Fruit.StopAfter = 4 t.Filter(FruitsXML) Console.WriteLine($"*** Stop after: {Fruit.StopAfter} ***") Console.WriteLine(t.Matches.Text) Fruit.StopAfter = -1 '// Resets back to infinity (default) for next example Console.WriteLine("") '// StartAfter() Fruit.StartAfter = 6 t.Filter(FruitsXML) Console.WriteLine($"*** Start after: {Fruit.StartAfter} ***") Console.WriteLine(t.Matches.Text) Fruit.StartAfter = 0 '// Resets back to 0 (default) for next example Console.WriteLine("") '// Both StartAfter() and StopAfter() Fruit.SetStartAfter(2).SetStopAfter(5) t.Filter(FruitsXML) Console.WriteLine($"*** Between {Fruit.StartAfter + 1} and {Fruit.StopAfter} ***") Console.WriteLine(t.Matches.Text) Console.WriteLine("") '// All uc.DefineVariable("x = 1") Fruit = t.FromTo("CommonName={@string:name}", "{@Eval: x++}. {name}") t.Filter(FruitsXML) Console.WriteLine("*** All ***") Console.WriteLine(t.Matches.Text) End Sub End Module