By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,967 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,967 IT Pros & Developers. It's quick & easy.

Case-insensitive str_replace

P: n/a
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......
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Wed, 06 Aug 2003 13:21:13 GMT, "Ian.H [dS]" <ia*@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 (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #2

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Wed, 06 Aug 2003 19:29:31 +0100, Andy
Hassall <an**@andyh.co.uk> amazingly managed to produce the following
with their Etch-A-Sketch:
On Wed, 06 Aug 2003 13:21:13 GMT, "Ian.H [dS]"
<ia*@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

lol.. that'll teach me eh? =)

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPzFdMmfqtj251CDhEQL8NwCgsBlFBpgbiZyozP9vmtjz4w x1vNEAnjFE
VBfacKyiROMH3B5EDnwe0MDa
=vHAT
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.