We'll have to agree to disagree. The horrible truth is that _is_ how I do quick and dirty one offs!

I do a lot of html parsing/rewriting. Machine generated, FrontPage generated (shudder), user generated, even beautifully hand knitted wfsp generated - and it always ends in tears.

50KB or 50 bytes, I don't care. "Where's the parser!" As with everything the more you do it the quicker it gets.

And anyways my one offs (in such a case as the OPs) always lead to "I wonder if any pages didn't have any links?", "How many?", "Which ones?", "Most popular link/least popular link?" And then, as night follows day, "What about a nice report? Sorted by file name/frequency and link/frequency?" You just can't predict what the site owner is going to come up with next. :-)

I've settled on HTML::TokeParser::Simple because I think it is as writable as it is readable (Ovid++), far more writable, readable, robust etc. than any regex is going to be.

Oh, and by the way, what's the command line? :-)

update:
As I was writing this the node expanded a tad! I agree with many of the latter points but my main view still stands.


In reply to Re^4: Replacing Text by wfsp
in thread Replacing Text by pyro.699

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.