I have an html file that I need to take any tag and put an align='left' into it.
So given the line :
<td><img alt="" src="oooh.html_files/px" style="width: 20px; height: 1px;"/></td>
I need it to do :
<td align='left'><img alt="" src="oooh.html_files/px" style="width: 20px; height: 1px;"/></td>
If it already specifies an alignment I need it to just leave this. So given the line :
<tr><td width="50%"> </td><td align="center">
I need it to do :
<tr><td width="50%" align='left'> </td><td align="center">
Note it puts an align into the first td, but ignores the second one because that already specifies an alignment.
Is this possible to do it Ruby with regular expressions?
I know its not really worth using regular expressions with html.. but basically I'm just after a quick hack to get over a bug in another library. Hopefully this bug will be fixed soon and I wont need to worry about it! :)