更新:我写了我所做的,包括源代码和需要注意的事项, - 在.NET XPath(我的博客)中添加XPath 2.0功能和变量.
有没有办法将正则表达式传递给.NET中XPath语句的matches()?
示例:执行xpath
"/windward-studios/Employees/Employee[matches(string(LastName), '.*A?B[12]C.*')]"
Run Code Online (Sandbox Code Playgroud)
XPath 2.0支持匹配功能.但是,.Net实现了XPath 1.0.
您需要添加自定义函数来实现匹配.请参阅http://msdn.microsoft.com/en-us/library/ms950806.aspx
它看起来像Mvp.Xml项目:EXSLT.NET模块实现了XPath 2.0的大部分内容; 包括比赛.见http://mvp-xml.sourceforge.net/exslt/