[PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Nicolas Verhaeghe
Hi all! I have a text highlight function which does not behave exactly as needed. Behavior is logical but result is cumbersome. Instead of replacing the portion of the text with the same portion of text with some highlighting code added before and after, it replaces the said text with the chunk

Re: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Chris
Here is the function: function highlight_text($text, $highlight) { return eregi_replace($highlight, span class=highlight . $highlight . /span, $text); } In this case, if the text to highglight is: MacOS X Super Gizmo And a client searches for the string macos, the result will be: span

RE: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Nicolas Verhaeghe
, because the string searched for is of a different case. But thanks for helping. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 22, 2006 5:39 PM To: Nicolas Verhaeghe Cc: php-general@lists.php.net Subject: Re: [PHP] Case issue with eregi_replace in text

Re: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Chris
Nicolas Verhaeghe wrote: That's not where the issue is. Eregi_replace conducts a case insensitive SEARCH but how the REPLACE operates has nothing to do with it. If you use ereg_replace, then it is most obviously not going to replace MacOS with span class=highlightmacos/span or even span

RE: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Chrome
: Nicolas Verhaeghe [mailto:[EMAIL PROTECTED] Sent: 23 February 2006 00:55 To: 'Chris' Cc: php-general@lists.php.net Subject: RE: [PHP] Case issue with eregi_replace in text highlight function That's not where the issue is. Eregi_replace conducts a case insensitive SEARCH but how the REPLACE operates

RE: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Nicolas Verhaeghe
- From: Nicolas Verhaeghe [mailto:[EMAIL PROTECTED] Sent: 23 February 2006 00:55 To: 'Chris' Cc: php-general@lists.php.net Subject: RE: [PHP] Case issue with eregi_replace in text highlight function That's not where the issue is. Eregi_replace conducts a case insensitive SEARCH but how