A practical, real-world example of using `SkipOver` to ignore HTML comments while transforming other parts of the document.

ID: 1124

See: SkipOver
				
					using uCalcSoftware;

var uc = new uCalc();
var t = uc.NewTransformer();
// Disable statement sensitivity to handle multi-line content
t.DefaultRuleSet.StatementSensitive = false;

var htmlContent =
"""

<nav>
  <li><a href="#intro">Intro</a></li>
  <!-- <li><a href="#contact">Contact</a></li> -->
  <li><a href="#about">About</a></li>
</nav>

""";
t.Text = htmlContent;

// A rule to find all list items
t.Pattern("<li>{item}</li>");

// A rule to skip over HTML comments
t.SkipOver("<!-- {comment} -->");

t.Find();
Console.WriteLine("--- Found List Items ---");
Console.WriteLine(t.Matches.Text);
				
			
--- Found List Items ---
<li><a href="#intro">Intro</a></li>
<li><a href="#about">About</a></li>
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto t = uc.NewTransformer();
   // Disable statement sensitivity to handle multi-line content
   t.DefaultRuleSet().StatementSensitive(false);

   auto htmlContent =
   R"(
<nav>
  <li><a href="#intro">Intro</a></li>
  <!-- <li><a href="#contact">Contact</a></li> -->
  <li><a href="#about">About</a></li>
</nav>
)";
   t.Text(htmlContent);

   // A rule to find all list items
   t.Pattern("<li>{item}</li>");

   // A rule to skip over HTML comments
   t.SkipOver("<!-- {comment} -->");

   t.Find();
   cout << "--- Found List Items ---" << endl;
   cout << t.Matches().Text() << endl;
}
				
			
--- Found List Items ---
<li><a href="#intro">Intro</a></li>
<li><a href="#about">About</a></li>
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim t = uc.NewTransformer()
      '// Disable statement sensitivity to handle multi-line content
      t.DefaultRuleSet.StatementSensitive = false
      
      Dim htmlContent =
      "
<nav>
  <li><a href=""#intro"">Intro</a></li>
  <!-- <li><a href=""#contact"">Contact</a></li> -->
  <li><a href=""#about"">About</a></li>
</nav>
"
      t.Text = htmlContent
      
      '// A rule to find all list items
      t.Pattern("<li>{item}</li>")
      
      '// A rule to skip over HTML comments
      t.SkipOver("<!-- {comment} -->")
      
      t.Find()
      Console.WriteLine("--- Found List Items ---")
      Console.WriteLine(t.Matches.Text)
   End Sub
End Module
				
			
--- Found List Items ---
<li><a href="#intro">Intro</a></li>
<li><a href="#about">About</a></li>