A simple demonstration of finding a word but only inside a specific parenthetical block.
ID: 1239
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// 1. Parent rule finds content inside parentheses.
var parentRule = t.FromTo("({body})", "({body})");
// 2. Get the local transformer for the parent.
var local_t = parentRule.LocalTransformer;
// 3. Child rule runs only inside the parentheses.
local_t.FromTo("this", "THIS");
var text = "do not find this, but (find this) and not this";
Console.WriteLine(t.Transform(text));
do not find this, but (find THIS) and not this using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // 1. Parent rule finds content inside parentheses. var parentRule = t.FromTo("({body})", "({body})"); // 2. Get the local transformer for the parent. var local_t = parentRule.LocalTransformer; // 3. Child rule runs only inside the parentheses. local_t.FromTo("this", "THIS"); var text = "do not find this, but (find this) and not this"; Console.WriteLine(t.Transform(text));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// 1. Parent rule finds content inside parentheses.
auto parentRule = t.FromTo("({body})", "({body})");
// 2. Get the local transformer for the parent.
auto local_t = parentRule.LocalTransformer();
// 3. Child rule runs only inside the parentheses.
local_t.FromTo("this", "THIS");
auto text = "do not find this, but (find this) and not this";
cout << t.Transform(text) << endl;
}
do not find this, but (find THIS) and not this #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // 1. Parent rule finds content inside parentheses. auto parentRule = t.FromTo("({body})", "({body})"); // 2. Get the local transformer for the parent. auto local_t = parentRule.LocalTransformer(); // 3. Child rule runs only inside the parentheses. local_t.FromTo("this", "THIS"); auto text = "do not find this, but (find this) and not this"; 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()
'// 1. Parent rule finds content inside parentheses.
Dim parentRule = t.FromTo("({body})", "({body})")
'// 2. Get the local transformer for the parent.
Dim local_t = parentRule.LocalTransformer
'// 3. Child rule runs only inside the parentheses.
local_t.FromTo("this", "THIS")
Dim text = "do not find this, but (find this) and not this"
Console.WriteLine(t.Transform(text))
End Sub
End Module
do not find this, but (find THIS) and not this Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// 1. Parent rule finds content inside parentheses. Dim parentRule = t.FromTo("({body})", "({body})") '// 2. Get the local transformer for the parent. Dim local_t = parentRule.LocalTransformer '// 3. Child rule runs only inside the parentheses. local_t.FromTo("this", "THIS") Dim text = "do not find this, but (find this) and not this" Console.WriteLine(t.Transform(text)) End Sub End Module