Grepping with Python - script/prog required.

Mike Rovner mike at
Tue Jun 24 02:52:30 CEST 2003

John Fitzsimons wrote:

> I want to search an ordered text file and list web links such as :
> and Output like ;
> Can anyone suggest the code and/or a python program/script I could
> adapt to do this please ?

That's very dirty (with high false positive and negative hits) url

import re
url=re.compile(r'(?<=\s)(?:(?:ftp|http|https)://|www(?:\.[^\. ]+){2,}).*?(?=
print '\n'.join(re.findall(url, your_text_goes_here))


More information about the Python-list mailing list