Regular Expressions 101

Community Patterns

Match all HTML heading elements and capture their titles


Regular Expression
.NET 7.0 (C#)



Useful for matching/finding and capturing/extracting the titles of HTML heading elements. This was used to identify all heading elements within the body of a web page for the purposes of generating a Table of Contents for the page. Note: This expression could be altered for different HTML element tags (e.g. paragraph, div, etc.)

Submitted by Darius Liktorius - 6 months ago