Skip to content

Commit

Permalink
Reto mouredev#11 - Python
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoAlvarezSchiaffino committed Dec 19, 2023
1 parent ec27848 commit 007b9b2
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import re

def ask_url():
"""
Prompt the user to enter a URL.
Returns:
str: The entered URL.
"""
return input("URL: ")

def extract_parameters(url):
"""
Extract parameters from the given URL using regular expressions.
Args:
url (str): The URL with parameters.
Returns:
list: A list containing the extracted parameter values.
"""
regex = r"([a-zA-Z0-9._%-]+)"
params = re.findall(regex, url)
return params

def main():
"""
Main function to execute the program.
"""
url = ask_url()
parameters = extract_parameters(url)

print(f"The parameters from the URL are: {parameters}")

if __name__ == "__main__":
main()

0 comments on commit 007b9b2

Please sign in to comment.