in reply to Regex help - butchering text into paragraphs

Throop:
Is this the thing that can /should be done in a single golfed line? Alternatively, is there a module that I should be looking at?

Is this part of a larger project? Then, golf wouldn't make much sense.

A simple way, in addition to the solution already posted, would combine the keys into a search expression.

From your description, it isn't completely clear (for me) what you are trying to do. I'll give my alternative below:

# ==> $keyptr, @inputs as in your code my $rg = join'|', map quotemeta, keys %$Keyptr; my @hits; push @hits, { /($rg):(.+?)(?=(?:$rg)|$)/g } for @inputs ; # thats it

You could dump the result w/the following loop:

... for my $rec (@hits) { print "====\n"; print "$_ => $rec->{$_}\n" for sort keys %$rec } ...

This would print then:

==== ANALYSIS => yada ^M yada CONCLUSION => drone drone ^M PREFACE => mumble ^M REMARKS => ixnay ==== ANALYSIS => Chuckle DEFERRED => blahblah ^M blah ^M NAME / NUMBER => John 369 REMARKS => Yada2

Regards

mwa