in reply to Re^2: Passing variables into regular expressions
in thread Passing variables into regular expressions
Interesting.
The docs indicate that the s flag causes the input string to be treated as if it's a single line. The m flag, on the other hand, causes the string to be treated as if it's multi-line.
It seems that .*? can't cross the newline character when using the m flag:
Treating the \n as whitespace (or explicitly naming it in the regex) seems to solve the problem. Any ideas why that'd be the case?# doesn't match my ($span_m) = $str =~ /(\d\d.*?\d\d)/m; # matches my ($span_m) = $str =~ /(\d\d.*?\n.*?\d\d)/m; # so does my ($span_m) = $str =~ /(\d\d\w+\s\w+\d\d/m;
-- Tanalis
#include www.liquidfusion.org.uk
In Section
Seekers of Perl Wisdom