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

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



Return to main thread