正则表达式使用记事本
替换XML标签之间的文本我需要替换所有URL标签,如果包含/mailto/ with notpad
我需要查找并替换HTML标签之间的文本。示例:
XML:
<urlset>
<url>
<loc>http://www.file3.ir/last-books/183-Education/The-Praeger-Handbook-of-Learning-and-the-Brain-%5B2-volumes%5D</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/last-books/183-Education/Learning-JavaScript</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/last-books/Category/183-Education/?start=868</loc>
<lastmod>1970-01-01T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=4ae20e207319a25c17f554db7a4e9fa6f2694865</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=034b3c240db5c92e676bdf91b7b4bdffd725c428</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=c704ffd88b576782f9135da4848ab22a3cfb0f53</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=6b28532ecf1950b9e755938e65c1a1b6e466483e</loc>
<lastmod>1970-01-01T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=a0ed06a8c2e075dbf1c1a23ae9203b2b464b166c</loc>
<lastmod>1970-01-01T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=63e8e699f6db77096398c390d78fa1cd1ee34b6c</loc>
<lastmod>1970-01-01T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=3a52445764cd71cad0a389f13b53faf5ae3a7dc5</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=9ea60360f4a81636f1e13f3a4e734016317d6179</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/component/mailto/?tmpl=component&template=jm_plus&link=42c96ca4e0c746bd9155234a619be95300714953</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/last-books/183-Education/Technical-Math-Demystified</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
</urlset>
替换之后:
<url>
<loc>http://www.file3.ir/last-books/183-Education/The-Praeger-Handbook-of-Learning-and-the-Brain-%5B2-volumes%5D</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/last-books/183-Education/Learning-JavaScript</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/last-books/Category/183-Education/?start=868</loc>
<lastmod>1970-01-01T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://www.file3.ir/last-books/183-Education/Technical-Math-Demystified</loc>
<lastmod>2015-05-02T21:15:06+00:00</lastmod>
<priority>0.00</priority>
<changefreq>monthly</changefreq>
</url>
</urlset>
帮助我...
您可以使用以下内容:
- 找到什么:
<url>[^<]+?<loc>[^<]+?/mailto/[^<]+?</loc>.+?</url>
- 搜索模式:
Regular Expression
。确保检查. matches newline
。
这应该删除您所追求的块。然后,您可以执行以下操作:Edit
-> Line Operations
-> Remove Empty Lines (Containing Blank Characters)
清除输入。