c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'Three, Four, One, Two, xFive9'; print qq{'$s'}; ;; my @numbers = $s =~ m{ \b [[:upper:]] [[:lower:]]+ \b }xmsg; printf qq{'$_' } for @numbers; print ''; ;; my %correct; @correct{ @numbers } = qw(one two three four); ;; my ($rx_search) = map qr{ \b (?: $_) \b }xms, join '|', map quotemeta, keys %correct ; print $rx_search; ;; $s =~ s{ ($rx_search) }{$correct{$1}}xmsg; print qq{'$s'}; " 'Three, Four, One, Two, xFive9' 'Three' 'Four' 'One' 'Two' (?^msx: \b (?: Four|Three|Two|One) \b ) 'one, two, three, four, xFive9'