[Zope] Scan for URLs from string

Peter Bengtsson mail@peterbe.com
Sat, 07 Dec 2002 19:14:08 +0000


I'm looking for a good regular expression that can spot URLs in a text string.
Either that or a regular expression that can deduce whether a string piece 
is a URL or not.

I would like to display piece of text where weblinks are converted to <A 
HREF...
Just like when you're reading emails that contain links. Those parsing 
usually go by startswith("http://") or startswith("www.") I guess.

Anybody got one? ...or has an idea of a module that already does this that 
I can nick.

NB: I don't want to check the URLs using urlopen() or equivalent. Must be 
faster than that.


Cheers, Peter