Hello I would like to use preg_match in PHP to parse the \"Desired text\" out of the following from a html document
Desired text &
if you want to return multiple matches then need to use preg_match_all(). You then loop through the second result group ($match[1]) to get just the content between tags.
$source = " Desired text1
".
" Desired text2
".
" Desired text3
";
preg_match_all("'(.*?)
'si", $source, $match);
foreach($match[1] as $val)
{
echo $val."
";
}
Outputs:
Desired text1
Desired text2
Desired text3