So something like this
<h2 style='margin-top: 10px;'>
<?php echo $title; ?>
</h2>
should become
<h1 style='margin-top: 10px;'>
<?php echo $title; ?>
</h1>
I use this code perl -pi -e 's/<h2(.*)<\/h2>/<h1\1<\/h1>/g' * but it works only if tags are in one line.
There is no need to pair up the opening and closing tags. Simply change all opening
<h2>tags to ‘` and then do the same for all closing tags. Like this