Hi Matt,

in preg_replace you should use regular expressions to specify what you
search. The form is "/<regular expression>/<options>".

So you regular expression is your text "test" and the option is "i" for
insnsitive search.

$print preg_replace("/test/i", "this is a test", "test TEST tEsT TEst")

Just take a look at the online help:
http://www.php.net/manual/en/function.preg-replace.php

regards,
carsten

P.S. another way is the function eregi_replace()
http://www.php.net/manual/en/function.eregi-replace.php


cs > -----Ursprüngliche Nachricht-----
cs > Von: Matthew [mailto:[EMAIL PROTECTED]]
cs > Gesendet: Dienstag, 3. April 2001 10:33
cs > An: [EMAIL PROTECTED]
cs > Betreff: [PHP-WIN] /i modifier with preg_replace
cs > 
cs > 
cs > Hello...
cs > 
cs > I'm trying to implement a case insensitive str_replace 
cs > (bearing in mind that
cs > I'll be performing the replace on a paragraph of text so I 
cs > don't want to
cs > convert it all to upper or lower case first).
cs > 
cs > Somebody suggested using the /i modifier with pregreplace 
cs > but I don't know
cs > where to put the modifier... i've put an example bit of 
cs > code below, can
cs > somebody please put the modifier in its rightful place for me?
cs > 
cs > $print preg_replace("test", "this is a test", "test TEST 
cs > tEsT TEst")
cs > 
cs > --
cs > 
cs > Matt
cs > [EMAIL PROTECTED]
cs > [EMAIL PROTECTED]
cs > < www.mralston.co.uk />
cs > 
cs > 
cs > 
cs > -- 
cs > PHP Windows Mailing List (http://www.php.net/)
cs > To unsubscribe, e-mail: [EMAIL PROTECTED]
cs > For additional commands, e-mail: [EMAIL PROTECTED]
cs > To contact the list administrators, e-mail: 
cs > [EMAIL PROTECTED]
cs > 

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to