so I have the code
function getTagContent($string, $tagname) { $pattern = \"/<$tagname.*?>(.*)<\\/$tagname>/\"; preg_match($pattern, $string
Probably because the title is spread on multiple lines. You need to add the option s so that the dot will also match any line returns.
s
$pattern = "/<$tagname.*?>(.*)<\/$tagname>/s";