Thanks Arturo for the tip! Why did I not think about it, I have no idea...

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:

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"; }
The problem I had was two-fold (or maybe even not. I think I was eluded by another bug I discovered in the process). In essence, everything is working now the way it's supposed to.

Thanks monks!


In reply to Re: Re: Regexp experts, come to rescue! by bman
in thread Regexp experts, come to rescue! by bman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.