diff --git a/inc/html.php b/inc/html.php
index b2b76f2c754d7adac96da2f6895ed1904309b10f..a0ae0110d29e5651667f18287f5f690b9428ad5f 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -265,7 +265,7 @@ function html_draft(){
 function html_hilight($html,$regex){
   // strip everything that's special except pipes:
   $regex = preg_replace('![\[\]()/\\\\?\.+*]+!','',$regex);
-  $regex = trim($regex,' |');
+  $regex = join('|',array_filter(array_map('trim',explode('|',$regex))));
 
   if ($regex === '') return $html;
   $html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);