trying another regex to remove extra spaces
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 23 Nov 2015 20:51:24 +0000 (15:51 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 23 Nov 2015 20:51:24 +0000 (15:51 -0500)
search.php

index 6a84b80..c25c697 100644 (file)
                                 }
 
                                 // 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 -->