Give headings IDs


/ Published in: Regular Expression
Save to your folder(s)

Convert headings to have id's with the content of the heading


Copy this code and paste it in your HTML
  1. Find:
  2. (<h[1-6])(>)(.+)(</h[1-6]>)
  3. Replace:
  4. $1 id="$3"$2$3$4
  5.  
  6. Turns
  7. <h4>Foobar</h4>
  8. into
  9. <h4 id="Foobar">Foobar</h4>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.