I have recently been given the task of assimilating a virtully unlimited number of webpages for certain bits of information that change from page to page. The good news is that all of the pages on a particular site are created by the same cgi script. The Bad news is that these templates differ between sites. I would like to create a program that would create functions specifically designed to to pull apart a particular page template. With a little user input (unless we could do with out it.)

Thus far I have been persuing a solution that would rely on enumerating the differences between two files. And the immediate context of those differances. My big hangup has been finding those differences AND getting their context. I have been fiddling with diff on the command line with some minor success. And I think with user input I could even roll out some regexes but I would really like to do this correctly. So I am calling on anyone with ideas to post to this thread. Thank you in advance.

-Douglas
Afterthought: I guess if diff produces whole lines instead of just the exact text that differs I could have the user input the text to be extracted and have the rest be the context. Oh Boy....

update (broquaint): dropped the <pre> tags and added formatting


In reply to Seeking input on pattern generation. by GermanHerman

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.