Forum Moderators: open
Here's the output;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> New Document </title>
</head>
<body><table>
<tr>
<td>notes://<a href="http://www.example.com/">www.example.com/</a></td>
</tr>
</table><script type="text/javascript">
// script here to correct notes:// links
</script></body>
</html>
I need to fix the link so that it ends up like;
<a href="notes://www.example.com/">notes://www.example.com/</a>
Any ideas would be really appreciated.
Thanks!
So I have the RegEx now and it works in the online tool - I just cannot get it to work via JavaScript.
Help? Here's the RegEx
Match
notes://<a href[\\s]?=[\\s\"\']+(http:)(.*?)[\"\']+.*?>([^<]+¦.*?)?
Replace
<a href="notes:$2">notes://$3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> New Document </title>
</head>
<body><table>
<tr>
<td>notes://<a href="http://www.cccc.com/c3245">www.cccc.com/c3245</a></td>
</tr>
</table><script type="text/javascript">
theString = document.body.innerHTML;stringToFind = /notes:\/\/<a href[\\s]?=[\\s\"\']+(http:)(.*?)[\"\']+.*?>([^<]+¦.*?)?/i;
newString = theString.replace(stringToFind, '<a href=\"notes:$2\">notes:\/\/$3');document.body.innerHTML = newString;
</script></body>
</html>
Hope it can help someone else at some point.