From 8d96e15bed31fcc33bdc7a9a90097db300787689 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Mon, 18 Mar 2024 12:40:43 +0100 Subject: [PATCH] Update: Docs string to include parameters & return --- archivist/utils/strings.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/archivist/utils/strings.py b/archivist/utils/strings.py index dee7170..6d84e9f 100644 --- a/archivist/utils/strings.py +++ b/archivist/utils/strings.py @@ -2,10 +2,16 @@ import re -def get_urls(string): - ''' - A function that returns all URLs from a string. - ''' +def get_urls(string:str = None) -> list: + """ + 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( r'((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)', re.IGNORECASE)