Skip to content

Commit

Permalink
Added utils.Links.find()
Browse files Browse the repository at this point in the history
  • Loading branch information
BenitzCoding committed Nov 20, 2021
1 parent 06df89c commit 0c776ea
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion utils/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,22 @@ def censor(content: str, censor: str = "*") -> str:
return content

else:
return string
return string

def find(content: str) -> list:
word_list = []
character_list = [';', get_slash(), '|', '-', '"', '&', '$', '@', '+', '^', '_', '<', '[', '!', '=', '>', '(', ')', '}', "'", '`', ']', '#', '%', '?', '*', '{', ',', '~']

link_list = []

for character in character_list:
text = content.replace(character, " ")
for word in text.split(" "):
word_list.append(word)
for word in word_list:
if re.match(REGEX, word):
link_list.append(word)
else:
continue

return link_list

0 comments on commit 0c776ea

Please sign in to comment.