Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      Dim txt = "<p id='aa'>xyz</p><p id='bb'>Hello</p ><p id='cc'>World</p>"
      t.Text = txt
      
      '// Parent rule matches the <p> tag. Its local transformer then extracts the 'id' attribute.
      Dim parentRule = t.Pattern("<p {etc}>")
      parentRule.LocalTransformer.FromTo("id={@string:id}", "{id}")
      t.Filter()
      
      Console.WriteLine("--- All Matches (Parent and Child) ---")
      Console.WriteLine(t.GetMatches(MatchesOption.All).Text)
      Console.WriteLine("")
      
      Console.WriteLine("--- RootLevelOnly (Parent Matches) ---")
      Console.WriteLine(t.GetMatches(MatchesOption.RootLevelOnly).Text)
      Console.WriteLine("")
      
      Console.WriteLine("--- InnermostOnly (Child Matches) ---")
      Console.WriteLine(t.GetMatches(MatchesOption.InnermostOnly).Text)
   End Sub
End Module