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, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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...... |
|
|||
|
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) |