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