query all Href that conains text and fix link
I have a website where the links are getting messed up in a table. They are being posted by a third party application and as far as I know javascript/jquery is the only way to fix them.
- <table>
- <tr>
- <th>Test1</th>
- <th>Test2</th>
- </tr>
- <tr>
- <td>test</td>
- <td><table><tr>
- <td><A href="file://\\test.com\folder\subfolder">\\test.com\folder\subfolder</A> test\jquerytest.doc
- </td></tr></table></td>
- </tr></table>
As you can see the program made the link
- <A href="file://\\test.com\folder\subfolder">\\test.com\folder\subfolder</A> test\jquerytest.doc
It should have made the link this way (messes up because of the space)
- <A href=file://\\test.com\folder\subfolder test\jquerytest.doc>\\test.com\folder\subfolder test\jquerytest.doc</a>
In this website \\test.com\folder\subfolder test
How can I write a query to find all <TD> that contains an href tag with \\test.com\folder\subfolder test?
Also Is it easy with jquery to fix the broken link with the correct link (as shown above) or would I just have to use regular expressions and javascript for it?
FYI the users are able to rearrange the columns in the table, so I will not be able to do it just by using the column index, unless there is a way to look for the Test2 header cell and figure out its index.