Replacing duplicate words in lines : Perl and C# regex included

Replacing duplicate words in lines : Perl and C# regex included

1
NewbieNewbie
1

    Nov 19, 2011#1

    Greetings from the paradise of Lanna, northern Thailand (no, no floods here); this is my first post on the UE forums.

    I searched this forum trying to find a way to remove duplicate words on each line, and found many posts relating to removing duplicate lines.

    But, on StackOverFlow, I found this post by resident genius/founder Jeff Atwood: Regular expression to find and remove duplicate words - C# which gave this C# regex: (\b\S+\b)(?=.*\1)

    I ran this in UE, with RegEx mode set to "Perl", and it "did the right thing" to my file.

    One responder, on the same StackOverFlow thread, however, suggested an alternative for Perl: Regular expression to find and remove duplicate words - Perl: \b(\S+)\b(?=.*\b\1\b.*)

    Hope this is useful. And, of course, I welcome comments, or alternatives.

    Thanks, Bill