A practical example where a 'data' rule is invalidated if it appears too few times, while a 'header' rule is unaffected.

ID: 949

				
					using uCalcSoftware;

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

Header: Section 1
Data: A
Data: B
Header: Section 2
Data: C

""";
t.Text = document;

var dataRule = t.Pattern("Data: {val}");
var headerRule = t.Pattern("Header: {val}");

dataRule.Minimum = 2;
Console.WriteLine("--- Find with Minimum(2) ---");
t.Find();
Console.WriteLine($"Total Matches: {t.Matches.Count()}");
Console.WriteLine($"Data Matches: {dataRule.Matches.Count()}");
Console.WriteLine($"Header Matches: {headerRule.Matches.Count()}");

dataRule.Minimum = 4;
Console.WriteLine("");
Console.WriteLine("--- Find with Minimum(4) ---");
t.Find();
Console.WriteLine($"Total Matches: {t.Matches.Count()}");
Console.WriteLine($"Data Matches: {dataRule.Matches.Count()}");
Console.WriteLine($"Header Matches: {headerRule.Matches.Count()}");
				
			
--- Find with Minimum(2) ---
Total Matches: 5
Data Matches: 3
Header Matches: 2

--- Find with Minimum(4) ---
Total Matches: 2
Data Matches: 0
Header Matches: 2
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   auto document = R"(
Header: Section 1
Data: A
Data: B
Header: Section 2
Data: C
)";
   t.Text(document);

   auto dataRule = t.Pattern("Data: {val}");
   auto headerRule = t.Pattern("Header: {val}");

   dataRule.Minimum(2);
   cout << "--- Find with Minimum(2) ---" << endl;
   t.Find();
   cout << "Total Matches: " << t.Matches().Count() << endl;
   cout << "Data Matches: " << dataRule.Matches().Count() << endl;
   cout << "Header Matches: " << headerRule.Matches().Count() << endl;

   dataRule.Minimum(4);
   cout << "" << endl;
   cout << "--- Find with Minimum(4) ---" << endl;
   t.Find();
   cout << "Total Matches: " << t.Matches().Count() << endl;
   cout << "Data Matches: " << dataRule.Matches().Count() << endl;
   cout << "Header Matches: " << headerRule.Matches().Count() << endl;
}
				
			
--- Find with Minimum(2) ---
Total Matches: 5
Data Matches: 3
Header Matches: 2

--- Find with Minimum(4) ---
Total Matches: 2
Data Matches: 0
Header Matches: 2
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      Dim document = "
Header: Section 1
Data: A
Data: B
Header: Section 2
Data: C
"
      t.Text = document
      
      Dim dataRule = t.Pattern("Data: {val}")
      Dim headerRule = t.Pattern("Header: {val}")
      
      dataRule.Minimum = 2
      Console.WriteLine("--- Find with Minimum(2) ---")
      t.Find()
      Console.WriteLine($"Total Matches: {t.Matches.Count()}")
      Console.WriteLine($"Data Matches: {dataRule.Matches.Count()}")
      Console.WriteLine($"Header Matches: {headerRule.Matches.Count()}")
      
      dataRule.Minimum = 4
      Console.WriteLine("")
      Console.WriteLine("--- Find with Minimum(4) ---")
      t.Find()
      Console.WriteLine($"Total Matches: {t.Matches.Count()}")
      Console.WriteLine($"Data Matches: {dataRule.Matches.Count()}")
      Console.WriteLine($"Header Matches: {headerRule.Matches.Count()}")
   End Sub
End Module
				
			
--- Find with Minimum(2) ---
Total Matches: 5
Data Matches: 3
Header Matches: 2

--- Find with Minimum(4) ---
Total Matches: 2
Data Matches: 0
Header Matches: 2