Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t As New uCalc.Transformer()
      
      '// Ignore multi-line formatting
      t.DefaultRuleSet.StatementSensitive = false
      
      '// 1. Parent rule captures the content of the <nav> block.
      Dim navRule = t.Pattern("<nav>{content}</nav>")
      
      '// 2. Get the local transformer for the nav block.
      Dim local_t = navRule.LocalTransformer
      
      '// 3. This rule will only find `<a>` tags inside the <nav> block.
      local_t.Pattern("<a href={url}>{text}</a>")
      
      Dim html = "
<nav>
  <a href=""/home"">Home</a>
  <a href=""/about"">About</a>
</nav>
<main>
  <p>Some text with another <a href=""/other"">other link</a>.</p>
</main>
"
      
      t.Text = html
      t.Find()
      
      Console.WriteLine("--- Found Links (Innermost Matches Only) ---")
      '// Use InnermostOnly to see only the results from the local transformer.
      Console.WriteLine(t.GetMatches(MatchesOption.InnermostOnly).Text)
   End Sub
End Module