/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import re myString = "This is my tweet check it out http://tinyurl.com/blah" print re.search("(?P<url>https?://[^\s]+)", myString).group("url")
URL: http://stackoverflow.com/questions/839994/extracting-a-url-in-python