Does HtmlAgilityPack have the ability to use regular expressions in its XPATH selector?

后端 未结 2 1139
醉话见心
醉话见心 2021-01-20 02:33

I would like to be able to create a collection of nodes where the text starts with a word and then a number. For example, given the following:

FIND

相关标签:
2条回答
  • 2021-01-20 03:10

    It's not available out-of-the-box, but you can add this functionality easily. It's described here: HtmlAgilityPack: xpath and regex

    0 讨论(0)
  • 2021-01-20 03:26

    No, the HTML Agility Pack does not currently support this. It supports XPath version 1 queries, which does not support regular expressions.

    That said, you'll have to do as you recommended and select using the XPath expression up to the point where you want to use a regular expression, and then use the Where extension method to filter out the appropriate nodes based on an RegEx instance.

    0 讨论(0)
提交回复
热议问题