diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 2df55d067b..3ab9e9802b 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -72,6 +72,7 @@ p,ul,td {font-size:10pt;}
[Fix] Changes to random number generator code to explicitly truncate the length of the string
[Fix] Quoting on boards with HTML enabled
[Fix] Redirect to list if cancelling deletion of ranks, smilies or word censors
+[Change] Backported more efficient highlighting code from Olympus
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 344a475478..ee564418ec 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1103,9 +1103,8 @@ for($i = 0; $i < $total_posts; $i++)
//
if ($highlight_match)
{
- // This was shamelessly 'borrowed' from volker at multiartstudio dot de
- // via php.net's annotated manual
- $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace('#\b(" . str_replace('\\', '\\\\', addslashes($highlight_match)) . ")\b#i', '\\\\1', '\\0')", '>' . $message . '<'), 1, -1));
+ // This has been back-ported from 3.0 CVS
+ $message = preg_replace('#(?!<.*)(?]*>)#i', '\1', $message);
}
//