I am working on a anti-spam chat bot and have been using the following Regex to catch spammers.
spam = re.compile(ur'(?:\b(\w+)\b) (?:\1(?: |$))+')
But, the issue with this is that it triggers when the same word repeated twice. How do i make this so it triggers if the word is repeated 4 times in total not just 2 times?