in reply to Re: Regexp experts, come to rescue!
in thread Regexp experts, come to rescue!
In any case, I finally made it work. Most of the times, the problem stairs right at you but you simply don't see it.
So, what I did whas this:
The problem I had was two-fold (or maybe even not. I think I was eluded by another bug I discovered in the process).my @patterns = qw(-[45j][15j] [1-3][a46]u 41u 57h 7[9l]b 8[046]u 9[ab] +t [1l][0b][uv] no [ou][j249][cdeg]); my $pattern = join "|", @patterns; # Arturo's suggestion my ($count) = 0; my $rm = 0; while (($CompName, $Department, $LogonDate, $NodeTel, $Model, $MTy +pe, $SinNum, $Room, $Name, $Division, $freespace, $userID) = $sth->fe +tchrow_array ()){ my $newpattern = $MType; $mySkip = $count % 2; $count = $count + 1; print "<tr"; if ($newpattern =~ /^${pattern}$/oi) { $rm++; print " bgcolor=\"red\""; $newpattern = shift; } elsif ($mySkip eq 0) { print " bgcolor=\"#CCFFCC\""; } else { print " bgcolor=\"white\""; } print ">\n"; }
I had it in the wrong order (lookup my first post).if ($mypattern =~ /$pattern/ig) { ... } elsif ($count eq 0) { ... } else { ... }
|
|---|