To have .
match any character, including a newline, compile your RE with re.DOTALL among the options (remember, if you have multiple options, use |
, the bit-or operator, between them, in order to combine them).
In this case I’m not sure you actually do need this — why not something like
re.findall(r'(\d+)\s+\d+\s+(WS-\S+)')
assuming for example that the way you identify a “model” is that it starts with WS-
? The fact that there will be newlines between one result of findall
and the next one is not a problem here. Can you explain exactly how you identify a “model” and why “multiline” is an issue? Maybe you want the re.MULTILINE to make ^
match at each start-of-line, to grab your data with some reference to the start of the lines…?