I use this to delete duplicated words (Notepad++ or Powergrep)
(\b\w+\b)\W+\1. replace with ${1}.
How can this be changed to find nonconsecutive duplicated words in one line and delete second duplicated word?
Example
word1, word2, word1, word3,
Result
word1, word2, word3,
Tried this but then it select both duplicated words and strings beetwen them.
(\b\w+\b)(.*?)\W+\1.
((\b\w+\b).*)\b\2\brepeatedly on the whole file until it finds no more duplicates, but it doesn't address any surrounding formatting. The other way is to split on whitespace, then recurse the array deleting dups, then rewrite the file.