Return to Snippet

Revision: 3754
at September 12, 2007 05:50 by andyhartleeds


Initial Code
// This will strip out any punctuation and spaces from filenames, replacing such characters with underscores
$filename = preg_replace("/[^a-zA-Z0-9s.]/", "_", $filename);

Initial URL

                                

Initial Description
Strip out non-alphanumeric characters. Very useful for use with filenames.

Initial Title
Regular expressions filename replace

Initial Tags
replace

Initial Language
PHP