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', 'Nuwbie', 'Dewbie', 'NEwbie');

foreach my $string (@arrayofstrings) {
	print "$string -- ";

	if ($string =~ /N.wbie/) {
		print " match found.\n";
	} else {
		print " no match.\n";
	}
}

exit;

Results:

Newbie --  match found.
Nuwbie --  match found.
Dewbie --  no match.
NEwbie --  match found.



Return to main thread
A little extra

#!/usr/bin/perl

use strict;

my (@arrayofstrings) = ('Newbie', 'Nuwbie', 'Dewbie', 'NEwbie');

foreach my $string (@arrayofstrings) {
	print "$string -- ";

	if ($string =~ /..wbie/) {
		print " match found.\n";
	} else {
		print " no match.\n";
	}
}

exit;

Results:

Newbie --  match found.
Nuwbie --  match found.
Dewbie --  match found.
NEwbie --  match found.



Return to main thread