in reply to regex issue
i made a mistake it should be length($_)==3.
A slightly different approach can give you what you are looking for. By using a lookahead, you can do what you want.
$term = 'Dit is het eerste het is niet het laatste Dit';
@captured = $term =~ /\b(\w\w\w)\b(?=.*\1\b)/g;
print join ' ', @captured;
Dit het het
The \b are word boudaries (change from letter/number/underscore) to non-letter/number/underscore or vice-versa.
The (?= looks forward for what comes after it, but remembers where it starts.
The \1 is the same as your \g1 (I unfortunately have an older perl.)
The g at the end means capture them all
het appears twice since it is there three times
Thanks. I missed that copying from the PC that has perl that I tested this on to this one.
The wind blew the wrong way
Leaves on the line
The wrong kind of snow
Yes, but I didn't inhale
Categorically, er, no. Unless I was drunk at the time
The lines of Venus were in the wrong juxtaposition
No-one needs more than 640K of RAM
The dog ate my homework
It's my first day
Results (109 votes). Check out past polls.