If I do this, for between the title tags, it works fine:
if ($c =~ /<title>(.*?)<\/title>/) { $out = $1; } above WORKS but if I try to do it for head or body, it doesnt return anything?
if ($c =~ /<body>(.*?)<\/body>/) { $out = $1; } above does NOT work
(and yes, the body or head tags are there and in lowercase, exact match)
Does this have anything to do with the linefeeds/newlines in the html?
Thanks for any assistance!
s - Treat the string as a Single line (i.e., ignore line breaks)
m - Treat the string as Multiple lines
So I'd write it:
$out = $1 if ($c =~ /<body>(.*?)<\/body>/s);
Yes Regex is tricky. It's basically a language of its own.