Dear Monks, I humbly beseech your help. I've been given over 9000 html pages from a dreamweaver website. The *real* content (minus templates and html tag garbage) is to be stripped out and converted into text files for addition to a Joomla site. So the structure of most of these pages looks like this: (gt/lt signs represented as '(' and ')'):

(html)
blah blah blah
(!-- #BeginEditable "region 1" --)
important stuff we wish to keep
(!-- #EndEditable --)
Unimportant stuff
(!-- #BeginEditable "region 2" --)
more stuff we wish to keep
(!-- #EndEditable --)
Some more unimportant stuff
(/html)

I've thrown everything into one monolithic line:

while (<>) {
chomp;
$big_line .= "$_ ";
}

then tried to run:

if ($big_line =~ /(!-- #BeginEditable ".*?" --)) {
$big_line =~ s/^.*?(!-- #BeginEditable ".*?" --)(.*?)(!-- #EndEditable --)/$1/;
}

But the problems I run into are:

-1- My pattern matching is missing something
-2- There are an indefinite number of BeginEditable tags any given file might have.
Ideally, the output would go something like:

EditableRegion X = (whatever's inside)
EditableRegion Y = (elsething)

I've used regex's for lots of things, but I might've met my match with this one. If anyone has wisdom, please bestow it upon a Brother.

Humbly Yourn,
charlie_pi

In reply to regex help humbly sought by charlie_pi

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.