in reply to Tricky regex problem
If that (update: oops... I meant to reply to that node) works for you, try this as a simplification (untested):
Beyond that, I have to say I don't understand your requirements. Can you express them more clearly?$input_text =~ s{ ^ ([#]{2,5}) \s+ [^\n]+ \s+ (?= ^ \1 [^#]) } {}xmsg;
Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom