This my Answer to the stackoverflow question: I need a regex for the href attribute for an mp3 file url in python:
As always I suggest using a html parser like lxml.html instead of regular expressions to extract informations from html files:
import lxml.html
tree = lxml.html.fromstring(htmlcode)
for link in tree.findall(".//a"):
url = link.get("href")
if url.endswith(".mp3"):
print url
