如何使用Notepad ++或Adobe Dreamweaver从HTML文件中提取特定文本? [英] How can I extract specific texts from an HTML file by using Notepad++ or Adobe Dreamweaver?

查看:182
本文介绍了如何使用Notepad ++或Adobe Dreamweaver从HTML文件中提取特定文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Notepad ++或Dreamweaver从HTML文件中提取 ID 属性。删除所有其他文本。

I want to extract the ID attribute from an HTML file by using Notepad++ or Dreamweaver. Delete all other texts.

例如:

<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">

我想这样从HTML中仅提取ID属性;

id="header"
id="header-message"
id="contact-form"
id="your-email"

那么我该怎么办?请帮助我。

So what I can do? Please help me..

推荐答案


  • Ctrl + H

  • 查找内容:< \w + [^>]] +(id =。+?)。*?>

  • 替换为: $ 1

  • 检查 环绕

  • 检查 正则表达式

  • 全部替换

    • Ctrl+H
    • Find what: <\w+[^>]+(id=".+?").*?>
    • Replace with: $1
    • CHECK Wrap around
    • CHECK Regular expression
    • Replace all
    • 说明:

      <\w+            # opening tag
      [^>]+           # 1 or more not >
      (id=".+?")      # group 1, id and value
      .*?             # 1 or more any character, not greedy
      >               # close tag
        
      

      屏幕截图(之前):

      屏幕截图(之后):

      这篇关于如何使用Notepad ++或Adobe Dreamweaver从HTML文件中提取特定文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆