
Pattern bug matching whitespace in multi-line match?
:
: >: The code below, when executed, indicates that the multi-line string $_
: >: matches white-space pattern /^\s*$/ when multi-line matching is enabled,
: >: even though $_ contains non-white-space characters. Am I overlooking
: >: something, or is this a bug?
:
: >Setting $* means that ^ and $ can match in the middle of the string, and
: >not just at the ends. So your pattern will match any empty line within
: >your string. It doesn't have to match your whole string.
:
: I guess this means there's no way to match the begining or end of the
: string in multiple-line mode (maybe Perl 5 should have ^^ and $$ r.e.
: operators??); but (he says in a flash of inspiration) one can see if
: $` and/or $' are empty to see if there is anything left unmatched
: before/after the matched section...
Alternately and/or alternatively, you can refrain from setting $*,
leaving ^ and $ to match the beginning and end of the string, and then
match on explicit \n in the middle.
Larry