search/replace in Python (solved)

Leif K-Brooks eurleif at ecritters.biz
Sat May 28 07:45:26 EDT 2005


Vamsee Krishna Gomatam wrote:
> text = re.sub( "<google>([^<]*)</google>", r'<a
> href="http://www.google.com/search?q=\1">\1</a>', text )

But see what happens when text contains spaces, or quotes, or
ampersands, or...



More information about the Python-list mailing list