Is this actually doable? I have some very long regex pattern rules that are hard to understand because they don’t fit into the screen at once. Example:
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)
Backslash or triple quotes won’t work.
You can split your regex pattern by quoting each segment. No backslashes needed.
You can also use the raw string flag
'r'and you’ll have to put it before each segment.See the docs: String literal concatenation