Regex cheatsheet UK National Insurance Number ^[a-zA-Z]{2}(?:\s*\d\s*){6}[a-zA-Z]?\s*$ HTML: Demote all (second) duplicate H1 tags to H2 Search ((<h1>[^<]*<\/h1>)(.|\s)+?)<h1>([^<]*)<\/h1> Replace $1<h2>$4</h2>