I'd like to turn some text into a link, based on it's position in the document.
The preceding HTML is consistent at each instance of the text which needs to be converted, but the text itself is not consistent. The link to be created would be in the form...
<a href="path/to/[text]">[text]</a>
where [text] is the text in question, and path/to is a fixed local path.
edited for clarification: The HTML is as follows:
To add some claricfication:
I have a webpage that contains a list of hostnames which I want to convert to a link to "file:/path/to/hostname" The hostnames are all preceded by the same HTML.
A sample of the relevant HTML section is as follows:
<div class="CSHEADER">[name] Addresses</div>
<table cellpadding="0" cellspacing="0" width="95%" border="1">
<tbody>
<tr bgcolor="#ddffdd">
<td>Address</td>
<td>Connection Types</td>
<td>Comments</td>
</tr>
<tr valign="top">
<td>[hostname1]</td>
<td>[text]</td>
<td>[text]</td>
</tr>
<tr valign="top">
<td>[hostname2]</td>
<td>[text]</td>
<td>[text]</td>
</tr>
</tbody>
</table>
This may appear several times in a single page. There may be anything between 1 and n hostnames in each table.
I just want to change [hostnamen] to
<a href="file://path/to/[hostnamen]">[hostnamen]</a>
The [name] and [text] text will vary from occurence to occurence, but is irrelevant to the link being created.