Case-insensitive str_replace

This is a discussion on Case-insensitive str_replace within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'm trying to replace strings in a body of html. These strings may contain spaces. str_replace works perfectly, ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-06-2003
-= Patrick =-
 
Posts: n/a
Default Case-insensitive str_replace

Hi,
I'm trying to replace strings in a body of html. These strings may
contain spaces. str_replace works perfectly, except that it is
case-sensitive. I've tried using eregi_replace, but I think there is
something wrong with my regex's. Here is my current code:

$bword may contain something like: "testing testing 123"

$bword = trim ($bword); //Remove trailing newlines
str_replace (' ', '[\s]', $bword); //Change spaces to [\s]
$urlhtml = eregi_replace ("[\s]($bword)[\s]", $replacecode, $urlhtml);

It seems to pick up some words, but not all......
Reply With Quote
  #2 (permalink)  
Old 08-06-2003
Andy Hassall
 
Posts: n/a
Default Re: Case-insensitive str_replace

On Wed, 06 Aug 2003 13:21:13 GMT, "Ian.H [dS]" <ian@WINDOZEdigiserv.net> wrote:

>What's wrong with str_ireplace() ?


http://uk2.php.net/str_ireplace

str_ireplace
(PHP 5 CVS only)

That's what ;-p

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:37 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0