File size: 340 Bytes
cebad5c
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import re

def extract_image_urls(text):
    # Regular expression to match image URLs
    pattern = re.compile(r'https?://[^\s]+\.jpg|https?://[^\s]+\.jpeg|https?://[^\s]+\.png|https?://[^\s]+\.gif|https?://[^\s]+\.bmp|https?://[^\s]+\.webp')

    # Find all matches in the input text
    matches = pattern.findall(text)

    return matches