简体   繁体   English

Notepad ++ html标签/字符串(a href)删除

[英]Notepad++ html tag / string (a href) remove

Have 12.000 links which I want delete and only display the Linktext over Notepad 有我想要删除的12.000个链接,只在记事本上显示Linktext

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? 有解决方案吗

Open up the Replace interface ( Ctrl + H ). 打开Replace界面( 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, 它将匹配任何a-tag,以及您可以通过输入在替换字段中调用的标记之间的文本,

\\1

Finally, press Replace All and you should be done. 最后,按“ 全部替换” ,您应该完成。

from my understanding you want to replace the entire line 从我的理解,你想要更换整行

<A HREF="/NEW/" target="_blank">NEW</A>

with

NEW

*nix wins * nix胜利

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 根据编辑器的不同,您可能需要删除一些反斜杠或将&1替换为&1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM