I need to find all lines matching the pattern, except for two given lines.
For example, find all letter groups except aaand bb. Starting from this line:
-a-bc-aa-def-bb-ghij-
Must return:
('a', 'bc', 'def', 'ghij')
I tried with this ordinary expression that captures 4 lines. I thought I was getting closer, but (1) it does not work in Python and (2) I cannot figure out how to exclude multiple lines from the search. (Yes, I could remove them later, but my real regex does everything in one shot, and I would like to include this last step in it.)
I said that it does not work in Python, because I tried this, expecting exactly the same result, but instead I get only the first group:
>>> import re
>>> re.search('-(\w.*?)(?=-)', '-a-bc-def-ghij-').groups()
('a',)
, .