I have a variable ($page
) that contains HTML code as follows:
<html>
<head>head</head>
<body>
<strong>12</strong>
recommendations
<br />
<strong>50</strong>
connections
</body>
</html>
Now I want to get the number of connections (in this case it's 50
) with a regular expression in PHP, so I use this:
preg_match('#<strong>(.*)</strong>#', $page, $connections)
But this gets 12
, not 50
. How can I solve this problem?