AW: [PHP-WIN] /i modifier with preg_replace
| From: | Carsten Senf | Date: | Tue, 03 Apr 2001 09:10:46 +0000 |
| Subject: | AW: [PHP-WIN] /i modifier with preg_replace | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-6455@lists.php.net to get a copy of this message | ||
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:matthew.ralston@haltoncollege.ac.uk]
cs > Gesendet: Dienstag, 3. April 2001 10:33
cs > An: php-windows@lists.php.net
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 > matthew.ralston@haltoncollege.ac.uk
cs > matthew@ralston.net
cs > < www.mralston.co.uk />
cs >
cs >
cs >
cs > --
cs > PHP Windows Mailing List (http://www.php.net/)
cs > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
cs > For additional commands, e-mail: php-windows-help@lists.php.net
cs > To contact the list administrators, e-mail:
cs > php-list-admin@lists.php.net
cs >