re.split() not keeping matched text
no_replies at fake_email_address.invalid
Sun Jul 25 21:25:29 CEST 2004
Given the following program:
x = "The dog ran. The cat eats! The bird flies? Done."
l = re.split("[.?!]", x)
for s in l:
I am getting the following output:
The dog ran
The cat eats
The bird flies
As you can see the end of sentence punctuation marks are being removed. Yet
the the docs for re.split() say that the matched text is supposed to be
returned. I want to keep the punctuation marks.
Where am I going wrong here?
More information about the Python-list