Re: preg_replace for multiple instances?

From: Date: Tue, 25 Jul 2000 16:58:05 +0000
Subject: Re: preg_replace for multiple instances?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-8087@lists.php.net to get a copy of this message
Don't you also need to add a "g" to replace all instances? as in $pattern = "/[\/\\\[\]\*]/g" or am i thinking of something else? Ed "Monte Ohrt" <monte@ispi.net> wrote in message news:397DA3BB.27BF13A1@ispi.net... > 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/ > > -- > 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 >

« previous php.general (#8087) next »