RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find header 2 anchor
Expression
"{(<h)([1-6])(.id=\")(.+?\")(.+?)(</h[1-6])}",'\\2~<a href="#\\4\\5</a'
Description
Easy way to transform header tag to its local referer. I use it to make TOC after reading headers.<br><b> &lt;h# id="identifier"&gt;Caption&lt;/h#&gt; -&gt; #~&lt;a href="#identifier"&gt;Caption&lt;/a&gt; </b><br>There is stored original heading's level in output.
Matches
&lt;h1 id="tag"&gt;Caption&lt;/h1&gt;
Non-Matches
&lt;H1 id="tag"&gt;Caption&lt;/H1&gt;
Author Rating: Not yet rated. Nocturnator
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials