[Python] Python regex failing on ?> [duplicate]

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

  1. Stack

    Stack Membro Participativo

    I have a simple Python function:

    return re.search("^([0-9a-zA-Z](?>[-.\\w]*[0-9a-zA-Z])*+@(?>[0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)++[a-zA-Z]{2,9})$", msg)


    However, I get the following error message when I go to run my tests:

    #13 1.260 itemsappend(_parse(source, state, verbose, nested + 1,
    #13 1.260 File "/usr/local/lib/python3.8/sre_parse.py", line 823, in _parse
    #13 1.260 raise source.error("unknown extension ?" + char,
    #13 1.260 re.error: unknown extension ?> at position 14


    Any ideas? I'm unsure why it's happening since the pattern works fine in Java.

    Continue reading...

Compartilhe esta Página