use strict; use warnings; my $text = "C:\\letters.txt"; open(my $fh_in, '<', $text) or die("Can't open $text: $!\n"); my $open = 0; while (<$fh_in>) { if (/^\[Sidenote /) { print("</div>\n") if $open; print("<div>\n"); $open = 1; } print; } print("</div>\n") if $open;
In reply to Re: Regexing a block of text in between patterns
by ikegami
in thread Regexing a block of text in between patterns
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |