Newbie dot Org HomePage
Visit one of our web buddies
Regular Expressions
Sample / Examples
Return to main thread

#!/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.



Return to main thread