in reply to Re^2: Perl RE; how to capture, and replace based on a block?
in thread Perl RE; how to capture, and replace based on a block?
Hi Chris, specifying a regex on the command line seems a difficult thing to do. At least you should be printing your $regexp to see what it contains.
In any case, this code seems to work:
my $str = " </div> </body> "; print "Success\n" if $str =~ /\<\/div\>\n\<\/body\>/;
which suggests that if you slurp in your whole file as a single string (e.g. by unsetting $/), your regex should do its job.
local $/; my $str = <>; print "Success\n" if $str =~ /\<\/div\>\n\<\/body\>/;
In Section
Seekers of Perl Wisdom