问题
.
I want to extract the ID attribute from an HTML file by using Notepad++ or Dreamweaver. Delete all other texts.
For Eg:
<div id="header" class="header-blue sticky">
<div id="header-message" class="alert alert-dismissible">
<form id="contact-form" class="custom-form" method="POST" action="https://www.google.com">
<input id="your-email" type="email" class="form-email" placeholder="Your Email">
I want to extract only ID attribute from HTML like this;
id="header"
id="header-message"
id="contact-form"
id="your-email"
So what I can do? Please help me..
.
回答1:
- Ctrl+H
- Find what:
<\w+[^>]+(id=".+?").*?>
- Replace with:
$1
- CHECK Wrap around
- CHECK Regular expression
- Replace all
Explanation:
<\w+ # opening tag
[^>]+ # 1 or more not >
(id=".+?") # group 1, id and value
.*? # 1 or more any character, not greedy
> # close tag
Screenshot (before):
Screenshot (after):
来源:https://stackoverflow.com/questions/62477359/how-can-i-extract-specific-texts-from-an-html-file-by-using-notepad-or-adobe-d