in reply to most efficient regex to delete duplicate words

Two points:
  1. I wouldn't worry about the efficiency until you get it working right. Doesn't matter how slow it is if it's incorrect.
  2. Why does it have to be a regex?
#!/usr/bin/perl -w use strict; my $test = "alpha beta beta gamma gamma gamma delta"; my %seen; my @out; for ( split( " ", $test ) ) { push( @out, $_ ) unless $seen{$_}++; } print join( " ", @out ), "\n";
This solution keeps the order, dedupes throughout the entire string, and doesn't use any regexes, and I'd bet it's a good deal quicker than any regex solution. Of course, you'll want to measure if you want to be sure.

xoxo,
Andy
--
<megaphone> Throw down the gun and tiara and come out of the float! </megaphone>