Hi ... I'm trying to take a chunk of badly formatted/indented code, and reformat it with the proper indentation.
I need a regular expression that will put all tags in an array, so I can recontruct the HTML like the example below.
I thought regular expressions would be a large part of the answer, but if anyone has a better idea on a better way to do this, i'm all ears ...
****** EXAMPLE ******
BEFORE processing :
--------------------------
----------
------
<html> <head> <title>Untitled Document
</title>
</head><body><table width="400" border="0">
<tr>
<td>
</td><td> </td></tr>
<tr><td> </td>
<td><table width="100%" border="1">
<tr> <td> </td>
<td> </td></tr> </table>
</td> </tr> <tr> <td> </td>
<td> </td>
</tr> </table> </body>
</html>
--------------------------
----------
------
AFTER processing :
--------------------------
----------
------
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<table width="400" border="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<table width="100%" border="1">
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
Start Free Trial