Update: Docs string to include parameters & return
This commit is contained in:
parent
7e6dd9d82d
commit
8d96e15bed
1 changed files with 10 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue