#!/usr/bin/perl
use strict;
my (@gerbal) = (
'Newbie',
'Newewbie',
'Newewewbie',
'Nbie',
'NewYewewbie',
);
foreach my $foot (@gerbal) {
print "$foot -- ";
if ($foot =~ /N(ew)+bie/) {
print " match found.\n";
} else {
print " no match.\n";
}
}
exit;
Results:
Newbie -- match found.
Newewbie -- match found.
Newewewbie -- match found.
Nbie -- no match.
NewYewewbie -- no match.
|