¿Es esto realmente factible? Tengo algunas reglas de patrón de expresiones regulares muy largas que son difíciles de entender porque no caben en la pantalla de una vez. Ejemplo:Cómo dividir reglas largas de expresión regular en varias líneas en Python
test = re.compile('(?P<full_path>.+):\d+:\s+warning:\s+Member\s+(?P<member_name>.+)\s+\((?P<member_type>%s)\) of (class|group|namespace)\s+(?P<class_name>.+)\s+is not documented' % (self.__MEMBER_TYPES), re.IGNORECASE)
Las comillas inversas o triples no funcionarán.
EDITAR. Terminé usando el VERBO más. Así es como se ve ahora el patrón de expresiones regulares:
test = re.compile('''
(?P<full_path> # Capture a group called full_path
.+ # It consists of one more characters of any type
) # Group ends
: # A literal colon
\d+ # One or more numbers (line number)
: # A literal colon
\s+warning:\s+parameters\sof\smember\s+ # An almost static string
(?P<member_name> # Capture a group called member_name
[ #
^: # Match anything but a colon (so finding a colon ends group)
]+ # Match one or more characters
) # Group ends
( # Start an unnamed group
:: # Two literal colons
(?P<function_name> # Start another group called function_name
\w+ # It consists on one or more alphanumeric characters
) # End group
)* # This group is entirely optional and does not apply to C
\s+are\snot\s\(all\)\sdocumented''', # And line ends with an almost static string
re.IGNORECASE|re.VERBOSE) # Let's not worry about case, because it seems to differ between Doxygen versions
're.VERBOSE' [Ejemplo] (http: // stackoverflow .com/questions/7957846/python-regex-meaning/7958248 # 7958248) – jfs
@JF Sebastian: ¡Tuve que dar +1 para re.DEBUG solo, eso hará mi vida mucho más fácil en el futuro! – Makis
@ J.F.Sebastian: subí tu respuesta detrás del enlace porque al final todavía terminé usándolo aunque requirió más edición (tenía que asegurarte de que cada espacio en blanco esté marcado correctamente). – Makis