Suggestion for a new regular expression extension

darrell dgallion at
Thu Nov 27 17:31:41 CET 2003

If you can make re.sub work for you...

import re
input="BD, BLD, BVD, BOUL, BOULEVARD.".split()

for i in input:
     print i, "::", re.sub(pat, "BD", i)

BD, :: BD,
BLD, :: BD,
BVD, :: BD,
BOUL, :: BD,

For more complex cases you can pass a function instead of the 
replacement string.


More information about the Python-list mailing list