#!/usr/bin/perl
use strict;
my (@arrayofstrings) = ('Newbie', 'NNewbie', 'NNNNNewbie', 'ewbie');
foreach my $string (@arrayofstrings) {
print "$string -- ";
if ($string =~ /N+ewbie/) {
print " match found.\n";
} else {
print " no match.\n";
}
}
exit;
Results:
Newbie -- match found.
NNewbie -- match found.
NNNNNewbie -- match found.
ewbie -- no match.
The "+" matches 1 or more.
|