I am having trouble with my regex for capturing consecutive capitalized words.
Here is what I want the regex to capture:
"said Polly Pocket and the toys" -> Polly Pocket
Here is the regex I am using:
re.findall('said ([A-Z][w-]*(s+[A-Z][w-]*)+)', article)
It returns the following:
[('Polly Pocket', ' Pocket')]
I want it to return:
['Polly Pocket']
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…