You're just giving fragments of a grammar. For instance, what's
object-group <protocol object-group name> (2 word)
mean? What are the rules here, and what the tokens? And what does the "2 word" mean?

With the stuff Yves did in 2006/2007 for the regex engine, you can write patterns that match anything that can be given in a BNF, but I cannot make out from your post what it is you want to parse.

Note however that if you really want to parse, single regexes aren't so suitable. Patterns are great for extracting and validation, but are rather kludgy for parsing. Because typically when you parse, you want to know the structure of they thing you parsed, and act accordingly. Regexes typically tell you they matched "abc", but won't tell you whether how that "abc" is composed (that is, if you'd have a regexp to parse English sentences, it will tell you that "John eats an apple" is a proper sentence, but it won't tell you it's composed as subject-verb-object, with the subject a proper name, the verb third person singular (present tense), and the object being "definite article-noun").


In reply to Re: Regex to match a Cisco ACL by JavaFan
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.