fork download
  1. import re
  2. p = re.compile(r'@([^\s:]+)')
  3. test_str = "@galaxy5univ I like you\nRT @BestOfGalaxies: Let's sit under the stars ...\n@jonghyun__bot .........((thanks)\nRT @yosizo: thanks.ddddd <https://y...content-available-to-author-only...o.com>\nRT @LDH_3_yui: #fam, ccccc https://m...content-available-to-author-only...s.com"
  4. print(p.findall(test_str))
  5. p2 = re.compile(r'(?:http|ftp|https)://(?:[\w_-]+(?:(?:\.[\w_-]+)+))(?:[\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?')
  6. print(p2.findall(test_str))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
['galaxy5univ', 'BestOfGalaxies', 'jonghyun__bot', 'yosizo', 'LDH_3_yui']
['https://y...content-available-to-author-only...o.com', 'https://m...content-available-to-author-only...s.com']