I am trying to get the content between <b>Author:</b> and <br> from the HTML below with preg_match_all function however it keeps returning empty arrays. I need the middle-line HTML output, please help me.
Here’s the text:
<b>Author:</b> <a href="http://link.com" target="_blank" rel="nofollow">Name</a><br />
Here’s the script I use:
preg_match_all("'<b>Author:</b> ([^<]*)<br />'", $page, $preg_author);
$author = $preg_author[1];
print_r($preg_author);
your regexp can’t work you’re looking for ([^<]*) basically this will fail when it will encounter the
<atag you should try this onebasically it will catch any character (no newline) until it will encounter a
tag