Thank you much, and I'm sorry my explaination was not very good, maybe this will be better
My original attempt produces
FUNCTION highlight( $String, $Needle, $f='black',$b='yellow' )
{
$string = preg_replace('/('.$Needle.')/i', "<span style=\"color: $f; background-color: $b;\">$1</span>", $String);
RETURN $string;
}
1) 01 1 20080617 20:01 00260 0
2) 01 1 20080617 07:11 00126 0
3) 01 1 20080616 17:50 00292 0
Here is what I'm trying to get with a Needle of 01 and the following string
1) 01 1 20080617 20:01 00260 0
2) 01 1 20080617 07:11 00126 0
3) 01 1 20080616 17:50 00292 0
IF I have a needle of 00260 then the following
1) 01 1 20080617 20:01 00260 0
2) 01 1 20080617 07:11 00126 0
3) 01 1 20080616 17:50 00292 0
With your code I wasn't able to get a highlight at all, I tried the following
$string = preg_replace('#^(\S+ )(\d+ \d+ \d+)#m', "$1<span style=\"color: #FF0000; background-color: #F7A836;\">$2</span>", $String);
$string = preg_replace('#^(\S+ )('.$Needle.')#m', "$1<span style=\"color: #FF0000; background-color: #F7A836;\">$2</span>", $String);
I'm wondering if your code is working on a space if so then I know that it's actually not a space but a tab between each column i.e. chr(9)
so 3)chr(9)01chr(9)1chr(9)20080616chr(9)17:50chr(9)00292chr(9)0<BR>
That's how the full string is made, so would that make a difference in your Preg?
Thanks for any further help๐