I want to count the number of personal pronouns such as I, we, my, ours and us in a sentence using regex. I want it to ignore US as it could be the name of a country.
My code is as follows
import re
pronounRegex = re.compile(r'I|we|my|ours|us',re.I)
pronouns = pronounRegex.findall(' I me you We and all of us make this team tweek, he is from US')
print(pronouns)
which prints
['I', 'We', 'us', 'i', 'we', 'i', 'US']
It is reading the "i" from "this" and "we" from "tweek". I'm not sure how to ignore those cases.