Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! python3
- # website finder
- import re, pyperclip
- #website regex
- website_regex = re.compile(r'''(
- (http://|https://)? # http or https
- (www\.)? # starting optionally with 'www'
- [a-zA-Z0-9-]+ # any letter, digit and hyphens allowed
- (\.) # obligatory dot
- (\w)+
- (\.)? # optional dot
- (\w)+
- )''', re.VERBOSE)
- text = pyperclip.paste()
- website_matches = website_regex.findall(text)
- all_matches = []
- for item in website_matches:
- all_matches.append(item[0])
- line = '\n'
- combined = line.join(all_matches)
- pyperclip.copy(combined)
Add Comment
Please, Sign In to add comment