我有这样的站点地图:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://mywebsite.com/article1</loc>
<lastmod>2014-08-10</lastmod>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://mywebsite.com/article2</loc>
<lastmod>2014-08-10</lastmod>
<changefreq>monthly</changefreq>
</url>
<url>
<loc>http://mywebsite.com/article3</loc>
<lastmod>2014-08-10</lastmod>
<changefreq>monthly</changefreq>
</url>
</urlset>
我只想保留其中的url。您知道匹配其他方法并一无所获的方法吗?非常感谢你 !
如果您想要的结果是这样的:
http://mywebsite.com/article1
http://mywebsite.com/article2
http://mywebsite.com/article3
搜索:
\h*<url\b.*?(http[^<]+).*?</url>|<.*?>\s*
并替换为捕获的URL(捕获在第一个括号组中)
\1
\h
匹配任何水平空间,[^<]+
匹配一个或多个字符,但不匹配<
确保选中该复选框 . matches \r and \n
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句