/^/
HardText Processing

Repeated Word Detector

Write a regex that detects when the same word appears twice in a row separated by whitespace, such as 'the the' or 'is is', a common typo in written text.

//
the the cat sat / this is is a test / no repeats here / buffalo buffalo buffalo

Test cases

  • the the cat satexpect match
  • this is is a testexpect match
  • no repeats hereexpect no match
  • buffalo buffalo buffaloexpect match
  • hello worldexpect no match
  • cat catsexpect no match
  • she said said nothingexpect match