I somehow missed this point when I made my first reply -- you said:

(I know about the XML::Parse and ::Twig modules, but using regex is a requirement)

Who/what makes this a requirement? Why are you required to do inferior work and to stifle your own experience in solving problems using best practices?

If it's because this is a homework assignment from teacher using bad methods to make you learn regexes, shame on you for not saying so. (I might still have posted the code I did, even knowing it was homework, since you did show some effort on your own. Honesty always pays in any case.)

If it's because the machine you're using doesn't have the required modules, there are ways around that -- like, installing the modules you need, inside your own home directory if necessary.

If it's because of some PHB forbids using the correct tools for the job, I offer my sympathy, and suggest you keep an eye open for other places to work.


In reply to Re: Parse XML with Perl regex by graff
in thread Parse XML with Perl regex by ad23

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.