How to use regular expression in lxml xpath?
accepted
class, but it also works for the xpath ()
4 down vote
< td>
http://lxml.de/xpathxslt.html # the-xpath-class
Note that you need to give the namespace mapping, so that it
functions. (see the lxml docs for the XPath < br /> namespaces = {“re”: “http://exslt.org/regular-expressions”})
the example). Lxml supports regular expressions from the EXSLT extension
< br /> You can do this (although you don need regular expressions for
knows what the “re” prefix in the xpath expression stands for.
doc.xpath (“/ / a [re: match (text (), ome text ]“,
method)