in reply to Re^2: Silly regex with match extrapolation
in thread Silly regex with match extrapolation

Take a look at Regexp::List. Consider:

use strict; use warnings; use Regexp::List; my @words = qw!bob fred frederic ann anne annie!; my $target = <<DATA; This list contains Bob, Frederic, Fred, Robert, Annette and Ann. And this list conatins Fred and Frederic. DATA my $match = Regexp::List->new (modifiers => 'i')->list2re (@words); my @matches = $target =~ /($match)/g; print "@matches";

Prints:

Bob Frederic Fred Anne Ann Fred Frederic

Perl reduces RSI - it saves typing

Replies are listed 'Best First'.
Re^4: Silly regex with match extrapolation
by elanghe (Novice) on Oct 14, 2008 at 01:19 UTC
    That's perfect! Thank you so much!