AARRRGH!!
I've been at this regex for 4 hours, now. Can someone tell me why this doesn't work?
The data:
SLOT 0 (RP/LC 0 ): Route Processor
SLOT 2 (RP/LC 2 ): 1 Port Packet Over SONET OC-12c/STM-4c Single Mode
SLOT 3 (RP/LC 3 ): 1 Port Packet Over SONET OC-12c/STM-4c Single Mode
SLOT 4 (RP/LC 4 ): 1 Port Packet Over SONET OC-12c/STM-4c Single Mode
SLOT 7 (RP/LC 7 ): 1 Port Packet Over SONET OC-12c/STM-4c Single Mode
SLOT 16 (CSC 0 ): Clock Scheduler Card(8)
SLOT 17 (CSC 1 ): Clock Scheduler Card(8)
SLOT 18 (SFC 0 ): Switch Fabric Card(8)
SLOT 19 (SFC 1 ): Switch Fabric Card(8)
SLOT 20 (SFC 2 ): Switch Fabric Card(8)
SLOT 24 (PS A1 ): DC Power Supply(8)
SLOT 26 (PS B1 ): DC Power Supply(8)
I want to match all lines, EXCEPT those containing, "Clock", "Switch", "Power", " Processor".
Here's the regex:
if ($rtr_diag =~ m/^(SLOT.*$)/ &&
! /(Processor.*$)/|/(Switch.*$)/|/(Power.*$)/|/(Clock.*$)/ )
{ do stuff}
What's going on, here??? I've tried
[^...]; didn't work. Along with every other way, but the right way, apparently.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.