简体   繁体   English

使用NotePad ++删除/剥离特定的HTML标签

[英]Remove/strip specific Html tags using NotePad++

Here is my text: 这是我的文字:

<a class="attachment-link" href="http://www.example.com/example-example/?example_id=example-example.jpg">

and I want to completly remove all of it. 并且我想完全删除所有内容。

There are several hundrets of those entries, I want to remove all entrys 这些条目有多个中心,我要删除所有条目

so I tried to use this regex in Notepad++ to replace with nothing: 所以我尝试在Notepad ++中使用此正则表达式替换为空:

<a .*class="attachment-link" href="#">(.*?)</a>

but it doesn't work. 但这不起作用。

I am new to using regex, I would appreaciate any help 我是使用正则表达式的新手,我将不胜感激

I created one test.html file: 我创建了一个test.html文件:

<a class="attachment-link" href="http://www.x.com/x-x/?x_id=x-x.jpg"> Some Text </a>
<a href="#"> Some Text </a>
<article>
    <a class="attachment-link" href="http://www.x.com/x-x/?x_id=x-x.jpg"> Some Text </a>
</article>

I used the "Replace All" action of Notepad++: 我使用了Notepad ++的“全部替换”操作:

在此处输入图片说明

Pattern: " <a\\s+class="attachment-link"(?:"[^"]*"|[^>])*>[\\s\\S]*?<\\/a> " 模式:“ <a\\s+class="attachment-link"(?:"[^"]*"|[^>])*>[\\s\\S]*?<\\/a>

And the result was: 结果是:

<a href="#"> Some Text </a>
<article>

</article>

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

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