Reputation: 11
Have 12.000 links which I want delete and only display the Linktext over Notepad
from
<A HREF="/" CLASS="size0verdgr">HOME</A>
to HOME
from
<A HREF="/NEW/" target="_blank">NEW</A>
to NEW
I can Use:
<a href="[^"]*" CLASS="[^"]*">
but there I can only delete the first part of the tag.
Any solutions?
Upvotes: 1
Views: 1698
Reputation: 1535
Open up the Replace interface (Ctrl+H). Change the search mode to "Regular Expression".
In the search field you enter the following pattern,
<a[^>]*>([^<]+)</a>
It will match any a-tag, and the text in between the tags you can call in the replace field by entering,
\1
Finally, press Replace All and you should be done.
Upvotes: 2
Reputation: 520
from my understanding you want to replace the entire line
<A HREF="/NEW/" target="_blank">NEW</A>
with
NEW
*nix wins
sed -i 's/<A HREF.\+>\(.\+\)<\/A>/\1/' test.txt
Thats the regex pattern so you can run that on any search and replace regex editor. Depending on the editor you may need to remove some back slashes or replace \1 with &1
Upvotes: 1