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)