You can download this code by clicking the button below.
This code is now available for download.
Extracts all URLs from the given text.
Technology Stack : Regular expressions (re)
Code Type : Function
Code Difficulty : Intermediate
import re
import math
import random
import datetime
import hashlib
import sys
def extract_urls(text):
url_pattern = re.compile(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')
return re.findall(url_pattern, text)