A basic pattern demonstrating how an optional word affects the match.
ID: 1204
See: Optional Parts
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
t.FromTo("Log [ERROR] entry", "MATCHED");
// This matches because the optional word is present
Console.WriteLine(t.Transform("Log ERROR entry found."));
// This also matches because the word is optional
Console.WriteLine(t.Transform("Log entry found."));
MATCHED found.
MATCHED found. using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); t.FromTo("Log [ERROR] entry", "MATCHED"); // This matches because the optional word is present Console.WriteLine(t.Transform("Log ERROR entry found.")); // This also matches because the word is optional Console.WriteLine(t.Transform("Log entry found."));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
t.FromTo("Log [ERROR] entry", "MATCHED");
// This matches because the optional word is present
cout << t.Transform("Log ERROR entry found.") << endl;
// This also matches because the word is optional
cout << t.Transform("Log entry found.") << endl;
}
MATCHED found.
MATCHED found. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("Log [ERROR] entry", "MATCHED"); // This matches because the optional word is present cout << t.Transform("Log ERROR entry found.") << endl; // This also matches because the word is optional cout << t.Transform("Log entry found.") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
t.FromTo("Log [ERROR] entry", "MATCHED")
'// This matches because the optional word is present
Console.WriteLine(t.Transform("Log ERROR entry found."))
'// This also matches because the word is optional
Console.WriteLine(t.Transform("Log entry found."))
End Sub
End Module
MATCHED found.
MATCHED found. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() t.FromTo("Log [ERROR] entry", "MATCHED") '// This matches because the optional word is present Console.WriteLine(t.Transform("Log ERROR entry found.")) '// This also matches because the word is optional Console.WriteLine(t.Transform("Log entry found.")) End Sub End Module