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

后端 未结 2 1141
醉话见心
醉话见心 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: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.

提交回复
热议问题