[lxml-dev] matches()

Stefan Behnel stefan_ml at behnel.de
Tue May 29 10:59:50 CEST 2007


Hi,

Ian Bicking wrote:
>    doc.xpath('descendant-or-self::*[matches(@href, "^javascript:", "i")]')
> 
> Returns ["i"].  This does not seem right...?

You're not calling the right function. The exslt functions are in the EXSLT
namespaces, so you have to do something like

   xpath('regexp:matches(., "^huhu", "i")',
         {'regexp':'http://exslt.org/regular-expressions})

Stefan


More information about the lxml-dev mailing list