How to use search_excerpt() function from core search module? I want to use the function search_excerpt() to generate excerpts. Unfortunately this function is returning exactly same text as I submit. For example I tried this:

$test = (search_excerpt('test', 'this is a test'));
print $test;


This is returning "this is a test".

I was expecting more something like: 


  "this is a test"


What is wrong in my code?
Try this code.I have just added a space after the string and this will surely work

$string = 'this is a test';   
$test = (search_excerpt('test', $string.' '));
print $test;


In the search_excerpt() if the search text is the last one, then preg_replace omits the search text.In order to overcome this I just added a empty space to the string.

// Highlight keywords. Must be done at once to prevent conflicts ('strong' and '&lt;strong&gt;').
  $text = preg_replace('/' . $boundary . '(' . implode('|', $keys) . ')' . $boundary . '/iu', '&lt;strong&gt;\0&lt;/strong&gt;', $text);