XPath正则表达式的文件扩展名

时间:2013-09-11 15:53:40

标签: regex xpath

<root>
    <url>
      <str>http://test.com/test.csv</str>
      <str>http://example.org/rsgis.html</str>
      <str>http://something.edu/thro.zip</str>
    </url>
</root>

使用Xpath,我只能找到网址的文件扩展名(csv或html或zip)。非常感谢任何帮助..

提前致谢。

1 个答案:

答案 0 :(得分:2)

使用/root/url/str/replace(tokenize(., '/')[last()], '.*\.', '')。或者真的不需要令牌化,您可以删除包括最新点.在内的所有内容/root/url/str/replace(., '.*\.', '')