Hello all,
Can anyone provide assistance with extracting data between the following symbols: <>
For example: <Data to be extracted. Resides here.>
I'm trying to get the above "data to be extracted resides here" text set as a variable for database inserting. I've tried preg_match but am unable to come up with the regular expression. Thank you.
//parse COMMENTS: <asdf>
$comments_start_position = strpos($message,"COMMENTS: ");
$comments_dirty = substr($message,$comments_start_position+11);
//retrieve comments
function get_comments($comments_dirty){
$h1tags = preg_match_all('/(<)(\w.*)(>)/ismU',$comments_dirty,$patterns);
$res = array();
array_push($res,$patterns[2]);
array_push($res,count($patterns[2]));
return $res;
}
$comments = get_comments($comments_dirty);
echo $comments;
All I get is the following text: Array