Internal Test: Verifies that the `subMatchGroup` parameter correctly extracts a capture group's content and that `ItemIs::QuotedText` works as expected.

ID: 1008

				
					using uCalcSoftware;

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

// Define a custom string literal using pipe characters `|...|`.
// The regex `\|([^\|]*)\|` captures the inner content in group 1.
// We set `subMatchGroup` to 1 to use this group as the token's value.
var pipeStringToken = t.Tokens.Add("""
\|([^\|]*)\|
""", TokenType.Literal, "", 1);

// Complete the definition by setting the data type and QuotedText property.
pipeStringToken.DataType = uc.DataTypeOf("String");
pipeStringToken.IsProperty(ItemIs.QuotedText, true);

// Define a simple rule to prove the token works.
t.FromTo("Test: {@String:s}", "Found: {s(0)} | Content: {s(1)}");

// The transformer now recognizes |...| as a string literal.
Console.WriteLine(t.Transform("Test: |hello|"));
				
			
Found: |hello| | Content: hello
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();

   // Define a custom string literal using pipe characters `|...|`.
   // The regex `\|([^\|]*)\|` captures the inner content in group 1.
   // We set `subMatchGroup` to 1 to use this group as the token's value.
   auto pipeStringToken = t.Tokens().Add(R"(\|([^\|]*)\|)", TokenType::Literal, "", 1);

   // Complete the definition by setting the data type and QuotedText property.
   pipeStringToken.DataType(uc.DataTypeOf("String"));
   pipeStringToken.IsProperty(ItemIs::QuotedText, true);

   // Define a simple rule to prove the token works.
   t.FromTo("Test: {@String:s}", "Found: {s(0)} | Content: {s(1)}");

   // The transformer now recognizes |...| as a string literal.
   cout << t.Transform("Test: |hello|") << endl;
}
				
			
Found: |hello| | Content: hello
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      
      '// Define a custom string literal using pipe characters `|...|`.
      '// The regex `\|([^\|]*)\|` captures the inner content in group 1.
      '// We set `subMatchGroup` to 1 to use this group as the token's value.
      Dim pipeStringToken = t.Tokens.Add("\|([^\|]*)\|", TokenType.Literal, "", 1)
      
      '// Complete the definition by setting the data type and QuotedText property.
      pipeStringToken.DataType = uc.DataTypeOf("String")
      pipeStringToken.IsProperty(ItemIs.QuotedText, true)
      
      '// Define a simple rule to prove the token works.
      t.FromTo("Test: {@String:s}", "Found: {s(0)} | Content: {s(1)}")
      
      '// The transformer now recognizes |...| as a string literal.
      Console.WriteLine(t.Transform("Test: |hello|"))
   End Sub
End Module
				
			
Found: |hello| | Content: hello