Answers for "python detect all href in string"

0

find allurl in text python

import re
text = '<p>Contents :</p><a href="https://w3resource.com">Python Examples</a><a href="http://github.com">Even More Examples</a>'
urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', text)
print("Original string: ",text)
print("Urls: ",urls)
Posted by: Guest on April-16-2020

Code answers related to "python detect all href in string"

Python Answers by Framework

Browse Popular Code Answers by Language