RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
s.com -Original Message- From: Erwin [mailto:erwin@;isiz.com] Sent: 04 November 2002 12:08 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Battling with highlighting search criteria > How can I get the return in the same case as it was originally? > > Ie if I have $string = "For

Re: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread Erwin
> How can I get the return in the same case as it was originally? > > Ie if I have $string = "Forward" , and $search = "for", I want > Forward, not forward. Read my reply to your previous reply ;-)) But...some more explanation: $result = preg_replace( '/(' . $search . ')/i', "\$1", $result ); T

Re: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread Erwin
>> Try the following one: >> >> $result = "This is a test, isn't it?"; >> $search = "is"; >> >> $result = preg_replace( '/(' . $search . ')/i', "> class=\"highlight\">\$1", $result ); >> >> >> Grtz Erwin David Russell wrote: > Hi Erwin, > > Yep, this does exactly what str_replace does. No, it doe

RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
ber 2002 11:54 AM To: 'Erwin'; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Battling with highlighting search criteria Hi Erwin, Yep, this does exactly what str_replace does. How can I make the whole thing case insensitive: $result= "This Is A Test, Isn't It?" $search= "

RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
in 'isn't'. cheers David Russell IT Support Manager Barloworld Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: [EMAIL PROTECTED] web: www.BarloworldOptimus.com -Original Message- From: Erwin [mailto:erwin@;isiz.com] Sent: 04 November 2002 11:27 AM To: [EM

Re: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread Erwin
David Russell wrote: > Hey there > > I told you my brain was feeling fuzzy :) > > This works great. Only one problem... I would like it to be case > insensitive... Any way? > > I assume that it would be a ereg/preg replace, but I have no clue with > regexp at all. Try the following one: $result =

RE: [PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread David Russell
Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: [EMAIL PROTECTED] web: www.BarloworldOptimus.com -Original Message- From: Erwin [mailto:erwin@;isiz.com] Sent: 04 November 2002 10:42 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Battling with highlighting search criteria

[PHP] Re: Battling with highlighting search criteria

2002-11-04 Thread Erwin
> I have a search string ($search) and a result ($result). I need to > highlight every occurance of $search in $result. > > I know that it means that I need to change (for example) > > $result = "This is a test, isn't it?" > $search = "is" > > Into > > $result = "this class="highlight">is a te