Oct-22-2019, 07:38 AM
(This post was last modified: Oct-22-2019, 07:39 AM by Gribouillis.)
For question 1, the match object will always have 5 groups, for example
>>> import re >>> p = re.compile(r'(f)(o)(o)|(b)(a)r') >>> match = p.search('This is a foo thing') >>> match.groups() ('f', 'o', 'o', None, None) >>> match = p.search('This is a bar thing') >>> match.groups() (None, None, None, 'b', 'a')For question 2, I don't understand the question. An example would help.