import re data = """Downtime for Christmas
by on 12/30/12 10:48 So, it appears the site was down for christmas. I could try to find out why, but I don't care enough. Went to 29c3, didn't get much done, ate a lot of fast food. I'm old, fat, and boring now. However, I found out about Edwards curves, that shit is rad. """ print re.sub(r'.*()(.*)().*', r"\n\n---\1\n---\2\n---\3", data)