正则表达式:查找重复的短语

时间:2017-08-17 21:34:25

标签: regex

有时候,我有时会在文字中发现整个短语。

The reason the reason why they cleaned....

\ b(\ w +)\ s + \ 1 \ b 找到重复的单词,但不是短语。

1 个答案:

答案 0 :(得分:2)

你可以使用正则表达式

\b(\w+(?:\s*\w*))\s+\1\b

查看演示here