regular expression help (was GUI re builder)
stephen.boulet at motorola.com
Mon Mar 31 19:47:41 CEST 2003
Matt Gerrans wrote:
> There should be an redemo.py in the tools/scripts directory, under Python22.
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?
More information about the Python-list