RE: [PHP] strtr question

From: Date: Wed, 28 May 2003 17:51:51 +0000
Subject: RE: [PHP] strtr question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149259@lists.php.net to get a copy of this message
Have you read up on regular expressions? They'll do just what you're looking for: <?php ereg_replace('[ab\.\,\ ]','',$string); // remove 'a', 'b', '.', ',' ?> http://www.php.net/ereg_replace --Joe -- Joe Stump <joe@joestump.net> http://www.joestump.net "Label makers are proof God wants Sys Admins to be happy." -----Original Message----- From: ed@homes2see.com [mailto:ed@homes2see.com] Sent: Wednesday, May 28, 2003 7:49 AM To: Joe Stump Subject: RE: [PHP] strtr question Yes this would be great only I'm not substituting a single character found in a filename but a host of characters found in filenames. Ed On Wed, 28 May 2003, Joe Stump wrote: > You could do this a number of ways: > > eregi(), ereg() or str_replace() ... > > <? > > $string = "What's up?"; > $string = str_replace("'",'',$string); > echo $string."\n"; > > ?> > > That will output "Whats up?" > > --Joe > > -- > Joe Stump <joe@joestump.net> > http://www.joestump.net > "Label makers are proof God wants Sys Admins to be happy." > > -----Original Message----- > From: ed@homes2see.com [mailto:ed@homes2see.com] > Sent: Wednesday, May 28, 2003 7:42 AM > To: php-general@lists.php.net > Subject: [PHP] strtr question > > > > I want to remove unwanted characters from filenames of files uploaded to > our server. I am currently using strtr to do this. I have a few characters > that are being removed but I would also like a single quote to be removed > if it is in the filename. I think it has to be escaped in the command > though. How do I do this? > > TIA, > > Ed > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#149259) next »