<?php

$html = <<< EOF
<div>another words</div>
<div>
  some text here
</div>
EOF;

preg_match('%<div>\s+(.*?text.*?)\s+</div>%s', $html, $result);
$result = $result[1];
echo $result;
