Find & Replace hyperlinks in a string

gsal salgerman at
Tue Nov 27 11:42:18 CET 2007

You mean in Python? 'cause if it is a one time shot kind of thing, I
would simply open the file in my favorite editor (NEdit) and use a
Search and Replace, check the regexp box and type my
expression...something along the lines of ([^:]+)://([^:/]+)(:
([0-9]+))?(/.*) to find URLs and then replace with <a href="\0">\0</
a> ...if I remember correctly that \0 is the entire match, \1 the
first parenthesised match, etc.


More information about the Python-list mailing list