> Okay, now I have to admit I'm also new to Perl, but I can adapt to change: > > /^.*\.[tj][pi][gfe].{0,1}$/i > > I threw in the quantifier to avoid what Felix exposed. Now, there's > probably a hole in this somewhere, but it's got to be a small one... > > -Paul >
Zeroth: It would better to say /^.*[tj][pi][gfe].?$/i, which would do the same thing, but still be just as wrong. First: That is wrong because it matches too many OTHER types - .tpg, .tpf, .tpe, and so forth (ten, plus thousands four-character variants). If you want to test for "this or that" you REALLY want to use /this|that/" not th[ia][st] #!/usr/bin/perl use strict; use warnings; my @word = qw /this that thit thas/ ; print "Wrong wronger, wrongest:\n"; for (@word) { print "$_\n" if /th[ia][st]/; } print "Better:\n"; for (@word) { print "$_\n" if /this|that/; } __END__ Produces the output: lawrence /tmp > ./test.pl Wrong wronger, wrongest: this that thit thas Better: this that -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>