#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; t.FromTo("{@Alpha:word}", "[{word}]"); string text = "id-E123 is a special-identifier."; cout << "--- Before --- " << endl; // By default, 'id-123' is tokenized as three separate parts: 'id', '-', and '123'. cout << t.Transform(text) << endl; // Get the alphanumeric token item by its name and modify its regex. auto alphaToken = t.Tokens()["_token_alphanumeric"]; alphaToken.Regex("[a-zA-Z0-9-]+"); cout << "" << endl; cout << "--- After --- " << endl; // Now, hyphenated words are matched as single alphanumeric tokens. cout << t.Transform(text) << endl; }