Re: Exact string replacement...
| From: | liljim | Date: | Sat, 09 Feb 2002 18:28:52 +0000 |
| Subject: | Re: Exact string replacement... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84120@lists.php.net to get a copy of this message | ||
Hello Desikan,
this should suit your needs.
<?
$string = "Is this is a way of getting strings containing \"is\" dismissed
from the string? It IS";
$pattern = "is";
$string = preg_replace("/(^|\s|[^a-z])" . $pattern . "($|\s|[^a-z])/is",
"$1$2", $string);
echo $string;
?>
~James
> Please help me out in the following...
>
> <?php
> $is='is';
> echo eregi_replace(" ".$is." "," ","This is a test string
> which contains
> is in dismissal");
> ?>
>
>
> Actually I want to replace "is" alone from the string and not all the
> words that contains is...