As well as the 's' modifier which, as you correctly state, is needed for '.' to match a newline; you'll also need the 'm' modifier for '^' to match the start of each line in a multi-line string (which paragraph mode [-00] will give you). Without this modifier, '^' will match only once at the start of the string. ("perlre: Modifiers" and "perlre: Metacharacters" have details of both of those.)
The following two points are really more a comment on the way the OP posted the sample data than on your solution.
The start of the regex (/^TEXT ...) assumes TEXT starts at the beginning of a line. While I agree that is likely to be the case for the real data, the HTML source for the posted data suggests otherwise:
<p> ... <br /> ... <br /> TEXT; <br /> LAYER 133;
The two '\n's in the regex suffer from a similar problem. While it's likely that the real data has lines that are only separated by a single newline, the posted data has additional whitespace before and after various lines.
-- Ken
In reply to Re^2: how to write multi-line regex
by kcott
in thread how to write multi-line regex
by herman4016
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |