I have this code for extracting urls from text in python3 :
import re
myString = "Lorem ipsum dolor sit amet https://www.lorem.com/ipsum.php?q=suas, pri omnes atomorum expetenda ex. Elit pertinacia no eos, nonumy comprehensam id mei. Ei eum maiestatis quaerendum lorem.org/132141222 "
print(re.search("(?P<url>https?://[^\s]+)", myString).group("url"))
the output I am getting is this :
https://www.lorem.com/ipsum.php?q=suas,
However I can not extract the second url : lorem.org/132141222
What is the best regular expression to extract all forms of urls in python. I want to extract even those incomplete and shortened URLs (without 'https' and 'www').