Answer the question
In order to leave comments, you need to log in
How to replace repeated words in a text with a reg expression?
How to replace repeated words in text with regular expression?
Found a code that removes duplicate words
var str='При при проверке были были найдены повторяющиеся слова';
alert(str.replace(/([^a-zА-яёЁ]|^)([a-zА-яёЁ]+) (\2)([^a-zA-ZА-яёЁ]|$)/gi,"$1"+"$2"+"$4"))
<strong>при</strong>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question