[Python] Using re.VERBOSE on a regular expression [duplicate]

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

  1. Stack

    Stack Membro Participativo

    How would I go about taking the following regular expression:

    re.compile(r'(\'?(("(\"|[^"])*")|^#.*\n|;.*\n|\(|\)|-?[0-9]+(\.[0-9]+)?|[a-zA-Z-#][a-zA-Z0-9.+-/\!]*))|\'.*')


    and writing it across multiple lines?

    For whatever reason my attempts at using re.VERBOSE seem to change the value of the expression.

    Continue reading...

Compartilhe esta Página