How do I remove a part of a line that has a specific beginning and ends in Notepad ++?
Let's say, for example, I have HTML code made up of many elements that looks like
<div id="1-element" class="1-element">...</div>
<div id="2-element" class="2-element">...</div>
...
<div id="99-element" class="99-element">...</div>
<div id="100-element" class="100-element">...</div>
...
I only need to remove all parts class="*-element"
from the whole document, but leave div
s, id
and other things using regex in Notepad ++. How can i do this?
+3
source to share
3 answers
This works for me:
-
In Notepad ++, open the search boxes, select the replace tab.
-
Find what:
\sclass="\d+-element"
-
Check regex.
-
Click Replace All.
- And the result:
<div id = "1-element"> </div>
<div id = "2-element"> ... </div>
<div id = "99-element"> </div>
<div id = "100-element"> </div>
+1
source to share