Regex to catch the use of directly repeated sentences in a row
I am trying to make a regular expression (Python Syntax, however not being used in Python directly) that catches when a user types multiple repeated phrases or sentences directly in a row. For example, the following case would be caught:
hi, how are you today. hi how are you today. hi how are you today. hi, how are you today. hi, how are you today. hi, how are you today. hi, how are you today.
But the following cases would not be caught:
hi, how are you today – said the first person. The second person responded – hi, how are you today back to them.
The hope is to specifically catch when a group of words of any length above 2 are repeated as a group more than 2 times in a row. Previous attempts I’ve made might catch the first example, but also catch when that phrase is repeated anywhere else in the full text as well, which becomes a large issue for people who repeat common expressions in their typing.
I can only find online examples for catching repeat single words, not repeat phrase groups. Could anyone provide aid/guidance?
Read more here: Source link