meshi
02-19-2008, 11:20 AM
i have this script function highlight($c,$q){
$q=explode('|',$q);
for($i=0;$i<sizeOf($q);$i++){
if (strlen($q[$i])==1){
$c=eregi_replace('[[:<:]]' . $q[$i] . '[[:>:]]', "<span class='z'>" .$q[$i]. "</span>", $c);}
else {
$c=preg_replace("/($q[$i])(?![^<]*>)/i","<span class='z'>\${1}</span>",$c);
}
}
return $c;
}
this code can highlight the search keyword.the problem is when i search c++ or C## only c is highlighted.i want to highlight the full word c++.please help me:(
$q=explode('|',$q);
for($i=0;$i<sizeOf($q);$i++){
if (strlen($q[$i])==1){
$c=eregi_replace('[[:<:]]' . $q[$i] . '[[:>:]]', "<span class='z'>" .$q[$i]. "</span>", $c);}
else {
$c=preg_replace("/($q[$i])(?![^<]*>)/i","<span class='z'>\${1}</span>",$c);
}
}
return $c;
}
this code can highlight the search keyword.the problem is when i search c++ or C## only c is highlighted.i want to highlight the full word c++.please help me:(