Replace specific links with the underlying linktext
Posted: Thu Jan 21, 2010 8:11 pm
Hi,
My target is to replace specific links (i.e. links to a specific domain with http ://www. or just http ://) or in other words links identified by a string. The replacement should be the linktext. I assume that this is quite a common filter but I could not find anything in the forum or in the filter list. The following Findings could not help me any further:
1. On Mon Dec 14, 2009 Simon wrote in a thread:
Why don't you just use Filters\Remove\HTML and XML\Remove all tags ?
2. Filter list: replace Hyperlink Target URL.fll and extract all external links.fll
This is my example text in which I want to replace all links to the domain example.com with the linktext but all other links should remain unchanged. So a link like <a class="css" title="here comes description" target="_blank" href="http://www.example.com/example.html">Text and so on</a> should become "Text and so on" or <a href="http://example.com/moreexamples.php">moretext</a> should now be converted to "moretext" whereas a link to all other domains should remain untouched.
I did some trial and error with
Perl Pattern
<a[^>]*>.*</a>
Send matching text to subfilter
but I am not good enough for it. Since I feel that this is a filter of general interest it might be good to get professional advice from Simon.
Thanks Simon
gerd
My target is to replace specific links (i.e. links to a specific domain with http ://www. or just http ://) or in other words links identified by a string. The replacement should be the linktext. I assume that this is quite a common filter but I could not find anything in the forum or in the filter list. The following Findings could not help me any further:
1. On Mon Dec 14, 2009 Simon wrote in a thread:
Why don't you just use Filters\Remove\HTML and XML\Remove all tags ?
2. Filter list: replace Hyperlink Target URL.fll and extract all external links.fll
This is my example text in which I want to replace all links to the domain example.com with the linktext but all other links should remain unchanged. So a link like <a class="css" title="here comes description" target="_blank" href="http://www.example.com/example.html">Text and so on</a> should become "Text and so on" or <a href="http://example.com/moreexamples.php">moretext</a> should now be converted to "moretext" whereas a link to all other domains should remain untouched.
I did some trial and error with
Perl Pattern
<a[^>]*>.*</a>
Send matching text to subfilter
but I am not good enough for it. Since I feel that this is a filter of general interest it might be good to get professional advice from Simon.
Thanks Simon
gerd