Update: Docs string to include parameters & return

This commit is contained in:
Aroy-Art 2024-03-18 12:40:43 +01:00
parent 7e6dd9d82d
commit 8d96e15bed
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -2,10 +2,16 @@
import re import re
def get_urls(string): def get_urls(string:str = None) -> list:
''' """
A function that returns all URLs from a string. Extracts URLs from a given string using regular expressions.
'''
Parameters:
string (str): The input string from which URLs need to be extracted.
Returns:
list: A list of URLs extracted from the input string.
"""
regex = re.compile( regex = re.compile(
r'((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)', r'((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)',
re.IGNORECASE) re.IGNORECASE)