On 28/10/2013 00:35, Marc wrote:
What was wrong with the answer Peter Otten gave you earlier today on the
tutor mailing list?

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence



I did not receive any answers from the Tutor list, so I thought I'd ask
here.  If an answer was posted to the Tutor list, it never made it to my
inbox.  Thanks to all that responded.


Okay, the following is taken directly from Peter's reply to you. Please don't shoot the messenger :)

You can reference a group in the regex with \N, e. g.:

>>> text = """"banner option delim
... banner text
... banner text
... banner text
... delim
... """
>>> re.compile(r"banner\s+(\w+)\s+(\S+)\s+(.+?)\2", re.MULTILINE |
re.DOTALL).findall(text)
[('option', 'delim', 'banner text\nbanner text\nbanner text\n')]


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to