sub regex2 { $_=$string; my $out=""; $out.=$1 while ( m/(.)(?!.*\1)/g ); return $out; }