Icons are not my fav things...
This is an example text, i want its favicons!!!
>>> z='Thanks a lot. But you are right, when type attribute is missing, or different the expression will not work. What have to be changed, that the type attribute, or anything other between "shortcut icon" and href will be ingored? It should work with: <link rel="shortcut icon" type="image/x-icon" href="//icons/favicon.ico" /> <link rel="shortcut icon" href="//icons/favicon.ico" /> and also with: <link rel="shortcut icon" 12345678 href="//icons/favicon.ico" /> <link rel="shortcut icon" 12345678 href="http://site.yeah.com/favicon.ico" /> Thank you'
>>> a = re.findall(r'(?<=\<link rel=[",\']shortcut icon[",\'])[ ,\w]* href=[",\'][\w,\/,:,.]*.ico[",\']',z)
>>> neu=[] >>> for item in a: neu.extend(re.findall(r'(?<=href=[",\'])[\w,\/,:,.]*.ico(?=[",\'])',item)) >>> neu ['//icons/favicon.ico', '//icons/favicon.ico', 'http://site.yeah.com/favicon.ico'] >>> WIN!











