Code: Select all
$html='<li>CAPTURE: I ONLY WANT THIS STRING</li><li>NOT THIS ONE</li><li>OR THIS ONE</li></ul>';
$pattern="/capture:\s(.*)(\<\/LI>)/i";
preg_match($pattern, $html, $results);
echo htmlentities($results[1])
[text]Output:
I ONLY WANT THIS STRING</li><li>NOT THIS ONE</li><li>OR THIS ONE
[/text]
I've tried a variety of patterns, but the closing tag is alluding me as a stopping point for the pattern. Can someone clue me in?