regular expression help (was GUI re builder)
Stephen Boulet
stephen.boulet at motorola.com
Mon Mar 31 12:47:41 EST 2003
Matt Gerrans wrote:
> There should be an redemo.py in the tools/scripts directory, under Python22.
Thanks Matt.
I have my date-matching re (for incidences of 3/31/03 or 12/3/2003, for example):
s = '3/31/03 some text 12/3/2003 some more text.'
p = re.compile('\d+/\d+/\d+')
s = p.sub('\n\n', s)
Now, I want to precede each match with two newlines. How do I do this, instead
of replacing each match like above?
-- Stephen
More information about the Python-list
mailing list