In the search script I use this function:
function highlightkeyword($string, $keyword, $color = '#DE6E08')
{
return preg_replace("/($keyword)/i", sprintf('<span style="color: #fff; background-color: %s; padding: 0 0.225rem;">$1</span>', $color), $string);}
This should higlight searched word. But now I need to search for word: "FNPBH/E3" which contains forward slash.
This scripts finds the item but it does not display its name. It gives error as shown below.
Warning: preg_replace(): Unknown modifier 'E' in line: 27
How to deal with it? Any way of escaping?