Seems to me this would be quite easy to implement reading a line at a time. Just keep a flag indicating whether you should be indenting or not.
while (<>) { if ( /^Heading Here:/ ) { $_ = "\n" . $_; $indent = 1; } elsif ( /^Another Heading:/ ) { $indent = 1; } elsif ( /^End of section:/ ) { $indent = 0; } elsif ( $indent ) { $_ = " " . $_; } print; }
In reply to Re: Regexp help
by ikegami
in thread Regexp help
by thewebsi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |