in reply to Remove repeated characters from a string
If you want to remove all duplicate letters, not just adjacent ones, this does it without any loops (external to the regex engine).
print $s; abacadaeafabacadaeafabacadaeafabacadaeafabacadaeafabacadaeaf $s =~ s[(.)(?=.*?\1)][]g; print $s; bcdeaf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:^2 Remove repeated characters from a string
by ysth (Canon) on May 13, 2004 at 16:23 UTC | |
by BrowserUk (Patriarch) on May 13, 2004 at 16:44 UTC |