Your expression is expecting following patterns 1) 3 or more digits OR 2) digit/s comma digit/s First tow values fit is none of the above-mentioned criteria and hence those are failing.
Thanks & Regards, Sandeep Deshpande -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Saturday, June 11, 2005 12:05 AM To: perl-unix-users@listserv.activestate.com Subject: [Perl-unix-users] regex numerical matching w/comma seperated listsupport #!/usr/bin/perl -w use strict; use warnings; my @values = ('1','12','123','1,2','12,34',',123','123,'); foreach my $value (@values) { # check that value is number and it can be comma seperated list of # numbers but doesn't have to be. the last two values in @values # are expected to fail, but it was not expected to fail for the # first two values. What change is needed or does an or statement # need to be used? if ($value =~ /^[0-9]+[0-9,]+[0-9]+$/) { print "[$value]: pass\n"; } else { print "[$value]: fail\n"; } } _______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs