}
// Highlight matches
- $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '<strong>$0</strong>', $output));
- $noNewLine = preg_replace('/[\n\r]+/', '', $context);
+ $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '<strong>$0</strong>', $output));
+ $noExtraSpace = preg_replace('!\s+!', ' ', $context);
?>
<p class="search_result_context">
- <?php echo $noNewLine ?>
+ <?php echo $noExtraSpace ?>
</p>
<!-- End of the Contextual/Highlight Search -->