OK... referencing your Reply, coupla more questions:
- Are you trying to scrape this or are you working with a saved_local_file? (if so, suspect you can swap some extra processing for much better results)
- Either it's waaay to late to comment (cuz brain went to sleep before body) or there is some very odd usage in the Boland blockquote (near "Libraries> which might be the close of a quoted link, except that I can't find a start). So question is: Can you count on well_formed html? Mere fragments (like your sample data)?
- added> This is NOT a complete .html page. If, in fact, you have such a page, you could use the </body> tag as a marker to determine which (possibly nested) blockquotes are at the end of the page.
- added> If all the .html fragments you want to clean up come from the same origin (the web4lib listserv), you can clean up the end of the file by starting near the end. As it turns out (depending on your example) there's a very easy place to truncate your file... just before the very first instance of
_______________________________________________
Web4lib mailing list
where there are 47 underlines, a newline, and the web4lib... credit.
added> In fact, the more I puzzle over this, the more I suspect that despite your certainty about your intent (as indicated by your caution to 'hold all "Why would you want to do that?" responses.' may reflect inadequate analysis of what you need to do to achieve your (still vague) objective.
added> Others, more skilled, may approach this differently, but IMO, writing complex regexen is only about 10% knowing syntax; the rest is analysing your dataset so that the logic of the regex is plain. So, consider writing (or at least, 'thinking through') a detailed example of what output you want from the processing and compare that -- in detail -- to the source, to get a clear view of what you need to do.
And again: This clearly is a case where you'll ascend unto the heavens more quickly and surely on the backs of those who've written "gold standard" modules as HTML::Parser, etc. than by re-inventing the wheel.
By way of confession; writing the regex you're seeking is not quite as simple as I suggested above for your source example,
... but ...
update Last 2 bullets and the 2 following paragraphs added (2005 Jun 8 2100 GMT), after 'puzzling' for a bit.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.