I have over 300 items in a list that I need to change the structure of. They are currently structured like this:
<li rel="/images/employees/kristi-robison-animated.gif">
<hgroup>
<h1>Kristi Robison</h1>
<h2>Senior Proofreader</h2>
</hgroup>
<img src="/images/css/shim.gif" data-static="/images/employees/kristi-robison-static.gif" alt="Kristi Robison">
</li>
… and I need to restructure it like this:
<li>
<hgroup>
<h1>Kristi Robison</h1>
<h2>Senior Proofreader</h2>
</hgroup>
<img src="/images/css/shim.gif" data-static="/images/employees/kristi-robison-static.gif" data-animated="/images/employees/kristi-robison-animated.gif" alt="Kristi Robison">
</li>
Because there are so many I don’t want to go through and do this manually. Is there a way to do this with a regex and find-and-replace?
Write a script, they’re really good at these things! Try piping your html file into this Ruby script for example: