Advertisement
viligen

extract_links

Nov 20th, 2021
715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. import re
  2.  
  3. pattern = r"(www.[A-Za-z0-9?\-?]+(\.[a-z]+)+)"
  4.  
  5. while True:
  6.     text = input()
  7.     if not text:
  8.         break
  9.     matches = re.findall(pattern, text)
  10.     if matches:
  11.         for match in matches:
  12.             print(match[0])
  13.            
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement