Mindy Geac wrote:
> So Im further right now, I need to put the hole ASCII table in de $special
> except :
> A..Z (0x41 0x5A
> a..z (0x61..0x7A
> 0..9 (0x30..0x39)
> space (0x20)
> À..? (0xC0..0x259)?!?
>
> Is there a better way to do this?
>
> -----------------------------
> "kerul4u" <....> wrote in message
>
> > Yes Ken u r right
> > Kimmo have u try putting two consecutive white space in
> >
> > $special = array('/','!','&','*'); //here you can add as many char. you
> > want
> >
> > I think you have not read it carefully //here you can add as many char.
> > you want
I use this for foldernames:
Not sure about alnum in the third one, if it allows foreign (to us in
the states) characters.
// clean up the user specified foldername
$foldername = stripslashes ( $_POST['foldername'] );
//This erase white-spaces on the beginning and the end in each line of
a string:
$foldername = preg_replace('~^(\s*)(.*?)(\s*)$~m', "\\2", $foldername);
//erases all NON-alfanumerics
$foldername = ereg_replace("[^[:alnum:] ]","",$foldername);
// take out repetative spaces:
$foldername = preg_replace('/\s\s+/', ' ', $foldername);
if ($foldername == ""){$foldername = "untitled";}
>> Stay informed about: Delete multiple spaces and special characters