in reply to Is this the best regex?

The regex /^\s\s\s\s\S.*:$/ captures this delimiter, but I cannot use the regex in split(/^\s\s\s\s\S.*:$/,$apps_rep);

Try  split(/^\s\s\s\s\S.*:$/m,$apps_rep);   (note the /m — it makes ^ and $ match the start/end of lines within the string)

You probably also want to put capturing parentheses in the pattern — /^\s\s\s\s(\S.*):$/m — in order to keep what was split on, i.e. you'd then get alternating entries for record title (app name) and record body.

Replies are listed 'Best First'.
Re^2: Is this the best regex?
by ikegami (Patriarch) on Sep 09, 2009 at 00:32 UTC
    Alternative that splits the records without doing additional parsing:
    split(/^(?=\s\s\s\s\S.*:$)/m, $apps_rep);
Re^2: Is this the best regex?
by Anonymous Monk on Sep 09, 2009 at 04:54 UTC

    Yes -- that fixes split, but my thinking was fuzzy. I got focused on why split did not work and forgot that if I did get it working, the delimiter would be thrown away. In the case, the delimiter is data because it has the program name!

    Thanks for the education on split. I am sure it will come in handy one day.

      Wait. I saw your comment re the capturing parentheses. How do I capture both the fields and the delimiters?
        I figured it out. SLICK! Split with capturing parens keeps that part of the delimiter. Slick!!