I am trying to replace an image link with a text format of the link only - http://localhost/.
I came up with this regular expression but it doesn't seem to work. Most probably it's wrong. Any ideas where is the problem? The idea is to make it work for all image links on the page, not only for the link in the example. What should I put as a string in this case?
<script>
function StripImageLinks() {
var re = /^.*?a href="|" id="image".*$/g;
var str = '<a href="http://localhost/" id="image" target="_blank"><img src="images/xls.png" width="128" height="128" alt=""/></a>';
var subst = '';
var result = str.replace(re, subst);
}
</script>