Re: preg_replace for multiple instances?
| From: | Monte Ohrt | Date: | Tue, 25 Jul 2000 14:27:07 +0000 |
| Subject: | Re: preg_replace for multiple instances? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8047@lists.php.net to get a copy of this message | ||
put everything you want to replace in brackets [] like so:
$pattern = "/[\/\\\[\]\*]/"
Geoff Cox wrote:
>
> Hello,
>
> I can use the following for single replacing the "[" character but how
> about multiple character replacement, eg replacing all instances of
> \,/,*[,] etc ?
>
> $newterm = $term;
> $pattern = "/\[/";
> $replacement = "";
> $result = preg_replace($pattern, $replacement, $newterm);
> $term =$result;
>
> Thanks
>
> Geoff
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/