#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11121725 use warnings; use List::Util qw( uniq ); my $text = "and him him lad has him done and john has has"; print "$_\n" for uniq $text =~ /(\b\w+\b)(?=.*?\b\1\b)/g;
Outputs:
and him has
In reply to Re: regex, find words that occur more than once.
by tybalt89
in thread regex, find words that occur more than once.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |