【发布时间】:2016-09-28 14:34:15
【问题描述】:
<block id="123">
<othertag1>...</othertag1>
<othertag2>...</othertag2>
<picture>...</picture>
<othertag3>...</othertag3>
<othertag4>...</othertag3>
</block>
如何使用ag 或grep 在许多文件中找到具有没有 <picture> 标签的此类块?
高级:从<block> 标记中获取"id"。 (例如将它们作为列表输出到标准输出)。
【问题讨论】:
-
不要使用正则表达式解析 HTML。在您选择的编程语言中使用专用的解析工具。正则表达式没有“块”之类的概念。
标签: regex grep html-parsing ag