Thanks a bunch! Your updated code is indeed amazing, for its level of detail and re-usable tokens. It just gives a greater level of control and granularity over matching schema without having to resort to a code that looks like hieroglyphics.

In hindsight, it was silly of me to ask again without checking the grammar. The last 3 rules failing is no surprise since the grammar doesn't account for it yet. I should produce a complete code soon, for the sake of others looking for the same stuff.

May I ask whether it is possible to code multi-line grammar also in to regex? For e.g the below section of config file

object-group network NOC-NC-NC1 network-object 192.162.137.0 255.255.255.0 network-object 192.162.146.0 255.255.255.0 object-group network NOC-NC-NC2 network-object 192.162.131.0 255.255.255.0 network-object 192.162.134.0 255.255.255.0

Should be read into a hash of arrays as:

$object_hash{"NOC-NC-NC1"} => ["192.162.137.0 255.255.255.0","192.162. +146.0 255.255.255.0"] $object_hash{"NOC-NC-NC2"} => ["192.162.131.0 255.255.255.0","192.162. +134.0 255.255.255.0"]

In reply to Re^6: Regex to match a Cisco ACL by Anonymous Monk
in thread Regex to match a Cisco ACL by Anonymous Monk

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.