>perl -wMstrict -le
"my $s = qq{\n\n};
print $s =~ /(\n$\n)/ ? qq{:$1:} : 'no match';
"
no match
>perl -wMstrict -le
"my $s = qq{\n\n};
print $s =~ /(\n$\n)/m ? qq{:$1:} : 'no match';
"
no match
####
>perl -wMstrict -le
"my $s = qq{\n\n};
print $s =~ /( \n $ \n )/x ? qq{:$1:} : 'no match';
"
:
:
>perl -wMstrict -le
"my $s = qq{\n\n};
print $s =~ /( \n $ \n )/xm ? qq{:$1:} : 'no match';
"
:
:
####
string=
no modifier: regex=/^a$\n/
match => $ matches only boundary, \n matches newline
[ ... ]
m modifier (multi line mode): regex=/^a$\n/m
match => $ matches only boundary, \n matches newline
####
>perl -wMstrict -le
"my $s = qq{a\n};
print $s =~ /^a$\n/ ? ' ' : 'NO ', 'match';
print $s =~ /^a$\n/m ? ' ' : 'NO ', 'match';
"
NO match
NO match
####
>perl -wMstrict -le
"my $s = qq{a\n};
print $s =~ /^ a $ \n/x ? ' ' : 'NO ', 'match';
print $s =~ /^ a $ \n/xm ? ' ' : 'NO ', 'match';
"
match
match