[Python] Regular expression syntax for "match nothing"?

Discussão em 'Python' iniciado por Stack, Maio 3, 2025.

  1. Stack

    Stack Membro Participativo

    I have a python template engine that heavily uses regexp. It uses concatenation like:

    re.compile( regexp1 + "|" + regexp2 + "*|" + regexp3 + "+" )


    I can modify the individual substrings (regexp1, regexp2 etc).

    Is there any small and light expression that matches nothing, which I can use inside a template where I don't want any matches? Unfortunately, sometimes '+' or '*' is appended to the regexp atom so I can't use an empty string - that will raise a "nothing to repeat" error.

    Continue reading...

Compartilhe esta Página