in reply to Regexp experts, come to rescue!
I would also offer '$MType =~ /^(-(41|55|jj)|(1a|24|36)u)$/' as a regexp that would match all the cases you list (and no others).if ($MType =~ /-[45][15j]/ig || $_ =~ /[123][a46]u/ig || $_ =~ /7[9l][hb]/ig ) { print "\"red\""; } else { print "\"#CCFFCC\""; }
my %matches; foreach (qw( -41 -55 -jj 1au 24u 36u)) { $matches{$_} = ''; } if (exists $matches{$MType}) { print "\"red\""; } else { print "\"#CCFFCC\""; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regexp experts, come to rescue!
by jeroenes (Priest) on Feb 01, 2001 at 20:17 UTC |