So I'm thankful for the help!

First off: deMize « he »

Second, I'm not sure what I did was the best way of going about things. What I'm doing is just building a CMS insertion page with as little markup as possible, where each section is contained in it's own div.

Response:
The first problem was getting each into their own div, which the lookahead helped. To accomplish this, it just ends the current div when it hits a new section (may be a subsection in the future).

The reason for removing the line breaks was because I was using that as a delimiter for the last section --- there is probably a better way of doing that with determining the end of the string in the RegEx (maybe $), but I need to replace those line breaks with HTML breaks anyhow.

The problem:
This means that it is going to be linear with no sub-divs. I might have to rethink that for later, because I might want to have something like this later:
[section] [top]Top Data [middle]Mid Data [bottom]Bottom Data [section] [top]Top Data [bottom]Bottom Data

Should result to:
<div class="section"> <div class="top">Top Data</div> <div class="middle">Middle Data</div> <div class="bottom">Bottom Data</div> </div> <div class="section"> <div class="top">Top Data</div> <div class="bottom">Bottom Data</div> </div>

What I plan to do is store either the sub sections in an array or the sections in an array. I could probably use help with a better algorithm.
The whole purpose of this was so that I could quickly type the data into one input box, without building a whole intricate interface (that can come later).





In reply to Re^3: Recursive Regex by deMize
in thread Parsing using Regex and Lookahead by deMize

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.