recently i see core team work on XOOPSCORE26/search.php
i suggest you to use select/highlight functions instead of hardcoding preg_replace function.
please see my code for doing it here:
https://sourceforge.net/p/xoops/svn/10275/tree/XoopsModules/newbb/branches/irmtfan/newbb/include/functions.text.php
by the above functions we can select and highlight text easily.
also we can improve the above functions more in the future.
also please take a look to my other request for using MODULE_NAME/search.php file instead of XOOPSCORE/search.php
it is very needed.
demo here:
http://www.jadoogaran.org/search.php?easiestml_lang=en
If highlighting is added I'd recommend the core team consider using the CakePHP Text helper functions which include highlighting. XOOPS already includes 'other' CakePHP functionality. Using this in combination with the improvements recommended by irmtfan and the CakePHP Inflector class (also recommended be reviewed for inclusion) we can greatly improve XOOPS search/results capabilities.