Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

regex findall

import re
# regex for finding mentions in a tweet
regex = r"(?<!RTs)@S+"
tweet = '@tony I am so over @got and @sarah is dead to me.'

# mentions = ['@tony', '@got', '@sarah'] 
mentions = re.findall(regex, tweet)
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #regex #findall
ADD COMMENT
Topic
Name
3+2 =