Regular expression to replace text between XML tags using Notepad++
I need to replace all URL tag if containe /mailto/ with "" in Notpad++
I need to find and replace text between html tags. Example:
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>
after replace:
<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>
help me...
You could use the following:
<url>[^<]+?<loc>[^<]+?/mailto/[^<]+?</loc>.+?</url>
Regular Expression
. Make sure you check . matches newline
. matches newline
. This should remove the chunks you are after. You can then do the following: Edit
-> Line Operations
-> Remove Empty Lines (Containing Blank Characters)
to clear your input.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.