in reply to Remove duplicate from the same line..

The following regex will remove any word or phrase that duplicates its immediate predecessor:

$string =~ s/ \b (.+) \b \s* \1 /$1/gx;

But note that an address such as “Long Island City, NY NY” will be reduced to “Long Island City, NY”.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Remove duplicate from the same line.
by Anonymous Monk on Jun 01, 2013 at 17:30 UTC
    Thx. Athanasius. but I have some more doubts, pls can you check the reply I gave to rpnoble