uCalc API Version: 2.1.3-preview.2 Released: 6/16/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.
CaseSensitive = [bool]
Property
Product:
Class:
Gets or sets whether pattern matching for this specific rule is case-sensitive, overriding the transformer's default setting.
Remarks
The CaseSensitive property allows you to control the case-sensitivity for an individual Rule, overriding the global setting inherited from the parent Transformer.
By default, all pattern matching in uCalc is case-insensitive.
⚙️ Getter and Setter Behavior
This property functions as both a getter and a setter:
Getter:
var isSensitive = myRule.CaseSensitive;Returnstrueif the rule is case-sensitive; otherwise,false.Setter:
myRule.CaseSensitive = true;Sets the case-sensitivity for the rule. The method returns theRuleobject itself, allowing for a fluent, chainable syntax.
Overriding the Default
This setting provides granular, per-rule control. It overrides the default case-sensitivity behavior defined in the parent transformer's DefaultRuleSet. This allows you to create a transformer that is case-insensitive by default but contains a few specific rules that must match case exactly.
💡 Why uCalc? (Comparative Analysis)
In most traditional Regex engines, case-insensitivity is a global flag applied to the entire pattern at compile time (e.g., the /i flag in JavaScript or RegexOptions.IgnoreCase in .NET). This is often an all-or-nothing choice.
uCalc's key advantage is its granularity. It allows you to mix case-sensitive and case-insensitive rules within the same Transformer and have them operate concurrently. This is extremely powerful for parsing languages or data formats where keywords might be case-insensitive (SELECT, select), but string literals or identifiers are case-sensitive ("MyVar" vs. "myvar"). This per-rule control provides a level of precision that is difficult to achieve with standard Regex libraries.
Examples
CaseSensitive
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.Str("start x y z finish, StArT a b c FinISH, START 1 2 3 FINISH");
var Pattern = t.Pattern("StArT {etc} FinISH");
Pattern.CaseSensitive = true;
Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}");
Console.WriteLine("-------------------");
t.Find();
Console.WriteLine(t.Matches.Text);
Console.WriteLine("");
Pattern.CaseSensitive = false;
Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}");
Console.WriteLine("--------------------");
t.Find();
Console.WriteLine(t.Matches.Text);
CaseSensitive: True
-------------------
StArT a b c FinISH
CaseSensitive: False
--------------------
start x y z finish
StArT a b c FinISH
START 1 2 3 FINISH using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.Str("start x y z finish, StArT a b c FinISH, START 1 2 3 FINISH"); var Pattern = t.Pattern("StArT {etc} FinISH"); Pattern.CaseSensitive = true; Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}"); Console.WriteLine("-------------------"); t.Find(); Console.WriteLine(t.Matches.Text); Console.WriteLine(""); Pattern.CaseSensitive = false; Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}"); Console.WriteLine("--------------------"); t.Find(); Console.WriteLine(t.Matches.Text);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
#define tf(IsTrue) ((IsTrue) ? "True" : "False")
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.Str("start x y z finish, StArT a b c FinISH, START 1 2 3 FINISH");
auto Pattern = t.Pattern("StArT {etc} FinISH");
Pattern.CaseSensitive(true);
cout << "CaseSensitive: " << tf(Pattern.CaseSensitive()) << endl;
cout << "-------------------" << endl;
t.Find();
cout << t.Matches().Text() << endl;
cout << "" << endl;
Pattern.CaseSensitive(false);
cout << "CaseSensitive: " << tf(Pattern.CaseSensitive()) << endl;
cout << "--------------------" << endl;
t.Find();
cout << t.Matches().Text() << endl;
}
CaseSensitive: True
-------------------
StArT a b c FinISH
CaseSensitive: False
--------------------
start x y z finish
StArT a b c FinISH
START 1 2 3 FINISH #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; #define tf(IsTrue) ((IsTrue) ? "True" : "False") int main() { uCalc uc; auto t = uc.NewTransformer(); t.Str("start x y z finish, StArT a b c FinISH, START 1 2 3 FINISH"); auto Pattern = t.Pattern("StArT {etc} FinISH"); Pattern.CaseSensitive(true); cout << "CaseSensitive: " << tf(Pattern.CaseSensitive()) << endl; cout << "-------------------" << endl; t.Find(); cout << t.Matches().Text() << endl; cout << "" << endl; Pattern.CaseSensitive(false); cout << "CaseSensitive: " << tf(Pattern.CaseSensitive()) << endl; cout << "--------------------" << endl; t.Find(); cout << t.Matches().Text() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.Str("start x y z finish, StArT a b c FinISH, START 1 2 3 FINISH")
Dim Pattern = t.Pattern("StArT {etc} FinISH")
Pattern.CaseSensitive = true
Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}")
Console.WriteLine("-------------------")
t.Find()
Console.WriteLine(t.Matches.Text)
Console.WriteLine("")
Pattern.CaseSensitive = false
Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}")
Console.WriteLine("--------------------")
t.Find()
Console.WriteLine(t.Matches.Text)
End Sub
End Module
CaseSensitive: True
-------------------
StArT a b c FinISH
CaseSensitive: False
--------------------
start x y z finish
StArT a b c FinISH
START 1 2 3 FINISH Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.Str("start x y z finish, StArT a b c FinISH, START 1 2 3 FINISH") Dim Pattern = t.Pattern("StArT {etc} FinISH") Pattern.CaseSensitive = true Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}") Console.WriteLine("-------------------") t.Find() Console.WriteLine(t.Matches.Text) Console.WriteLine("") Pattern.CaseSensitive = false Console.WriteLine($"CaseSensitive: {Pattern.CaseSensitive}") Console.WriteLine("--------------------") t.Find() Console.WriteLine(t.Matches.Text) End Sub End Module