HTML and CSS Reference
TagSoup and Tidy will convert these elements as part of their fix-up. However, neither adds the class="empty"
attributes. You can add those with an extra search and replace step at the end, or you can just make the entire
change with search and replace. I would start with the <br/> element. You can simply search for all <br> tags
and replace them with <br class="empty" /> .
However, there are a few things to watch out for. The first is whether someone has already done this. Check to
see whether there are any </br> elements in the source. If any appear, first remove them, as they're no longer
The remaining concern is br tags with attributes, such as <br clear="all"> . You can find these by searching
for " <br ."
If there aren't too many of these, I might just open the files and fix them manually. If there are a lot of them,
you can automate the process, but this will require a slightly more complicated regular expression. The search
The replace expression is:
<br \1=\2 />
When you're done, run your test suite to make sure all is well and you haven't accidentally broken something.
The hr element is handled almost identically. The meta and link elements are trickier because they almost
always have attributes, so you need to use the more complicated form of the regular expressions. Of course,
Tidy and TagSoup are also options.