Anyone here good with regular expression that can give me some help to get started. Here is what I need to accomplish.
I’m trying to parse through an HTML file looking for all <img> tags and some parameters within the image tag. Example:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
<BODY>
<table>
<tr>
<td><img src=”image1.jpg” width=”30” height=”30”></td>
<td><img src=”image2.jpg” width=”60” height=”20”></td>
</tr>
</table>
</BODY>
</HTML>
What I need to do is have it rewrite the file but with added information, example:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
<BODY>
<table>
<tr>
<td>Tag: <img src=”image1.jpg” width=”30” height=”30”> Image: image1.jpg Width: 30 Height: 30<img src=”image1.jpg” width=”30” height=”30”></td>
<td>Tag: <img src=”image2.jpg” width=”60” height=”20”> Image: image2.jpg Width: 60 Height: 20<img src=”image2.jpg” width=”60” height=”20”></td>
</tr>
</table>
</BODY>
</HTML>
Basically it needs to grab the whole images tag, and break it out in a few pieces to write the text information in front of it. Anyone have a similar script to give me a start or can help out.
Any help would be appriciated.