[Python] How to use regular expression in lxml xpath?

Discussão em 'Python' iniciado por Stack, Junho 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using construction like this:

    doc = parse(url).getroot()
    links = doc.xpath("//a[text()='some text']")


    But I need to select all links which have text beginning with "some text", so I'm wondering is there any way to use regexp here? Didn't find anything in lxml documentation

    Continue reading...

Compartilhe esta Página