Thanks, the ereg_replace example didn't work for me (even after fixing the typo). A-Za-z0-9 is fine for my needs, replacing them with "".
What is your preg_replace allowing? Thanks! Shawn "Peter Mr. Eps Thoenen" <[EMAIL PROTECTED]> wrote in message news:A733FF9B1FB0F441B3A6209FF71030E50169B287@;bondsteel2.areur.army.mil... > close but preg_replace("/[^[:print:]]/",'',$str); is what you want. > > The below would work but typo'ed ... ereg_replce should be ereg_replace > > Also..that is just A-Za-z0-9 ... many OS's allow punctation also...[:print:] > will cover this. > > Now only if php supported [:control:] and [:graph:] :) > > -Peter > > > -----Original Message----- > > From: Shawn McKenzie [mailto:nospam@;mckenzies.net] > > Sent: Friday, October 25, 2002 04:48 > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Replace illegal filename chars??? > > > > > > Doesn't work. It returned the same as what I put in: What's Up Doc? > > > > -Shawn > > > > "Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message > > news:20021024122630.4E99.MAXIM@;php.net... > > > > > > Use a regular expression like: > > > > > > $str = ereg_replce("/[^[:alnum:]]/i", '', $str); > > > > > > > > > -- > > > Maxim Maletsky > > > [EMAIL PROTECTED] > > > > > > > > > www.PHPBeginner.com // PHP for Beginners > > > www.maxim.cx // my Home > > > > > > // my Wish List: ( Get me something! ) > > > http://www.amazon.com/exec/obidos/registry/2IXE7SMI5EDI3 > > > > > > > > > > > > Marek Kilimajer <[EMAIL PROTECTED]> wrote... : > > > > > > > I use strtr() for this > > > > > > > > Shawn McKenzie wrote: > > > > > > > > >Anyone have a good way to remove from a string all characters and > > spaces > > > > >that are illegal in a filename??? > > > > > > > > > >$string = "What's up Doc?"; > > > > > > > > > >I need: > > > > > > > > > >$filename = "whatsupdoc"; > > > > > > > > > >TIA > > > > >-Shawn > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php