I am trying to build a regular expression for below files.

HIGH-LEVEL Status file for process (can be in below formats)

server_load_<ipaddress>.<ipaddress>.SKIP server_load_<ipaddress>.xyz_<ipaddress>.SKIP Example. server_load_IP100.69.82.21.IP100.69.82.81.SKIP server_load_IP100.69.82.21.ny_IP100.69.82.81.SKIP

Detailed Status file for process (can be in below formats)

server_load_<ipaddress>.<ipaddress>.xyx_ABC-2.SKIP server_load_<ipaddress>.ny_<ipaddress>.ABC_load.SKIP Example server_load_IP100.69.82.21.IP100.69.82.81.ny_AMER-2.SKIP server_load_IP100.69.82.21.ny_IP100.69.82.81.AMER_load.SKIP

My regular expression SHOULD NOT match any name from HIGH-LEVEL Status file for process. only that will work for Detailed Status file for process.

Tried using Look-ahead and look-behind concepts, but not able to get my best.

#!/usr/bin/perl use strict; use warnings; while (<DATA>) { if (/^(?<!server_load_IP100.69.82.21\s).*.SKIP/) {print "Good Match "; +} else {"Bad Match ";} print; } __DATA__ server_load_IP100.69.82.21.IP100.69.82.81.SKIP server_load_IP100.69.82.21.IP100.69.82.81.ny_AMER-2.SKIP
Output =============== Good Match server_load_IP100.69.82.21.IP100.69.82.81.SKIP ==> Ideall +y this is HIGH-LEVEL Status file for process should be "Bad Match " Good Match server_load_IP100.69.82.21.IP100.69.82.81.ny_AMER-2.SKIP

Any thoughts or guidance please. Thanks.


In reply to Deriving File name convention with Look-ahead and look-behind assertion by Magnolia25

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.