"John Dunlop" <us*********@john.dunlop.name> wrote in message
news:MP************************@News.Individual.NE T...
J. Frank Parnell wrote:
[ ... ]
this is working ok, but i cant figure out how to allow spaces between
words
(ereg_replace("[^[:alnum:]+]","-", is inserting dashes)
Substitute a space for the plus sign, giving you
ereg_replace('[^[:alnum:] ]','-',$subject)
Note, though, that as it was, your pattern matched any *one*
character excluding alphanumerics and the plus sign itself,
not any characters except one or more alphanumerics. That
is, the plus sign wasn't a metacharacter; it had no special
meaning.
Thanks, i thought i had tried every possible combination. And i was under
the impression that the + was 'means "match one or more of the previous
expression", and i had many combinations with that + sign that caused the
alnum-only thing to not work...
also, i added this
$foldername = preg_replace('/\s\s+/', ' ', $foldername); to get rid of
excess spaces. so, now i have:
$foldername = stripslashes ( $_POST['foldername'] );
$foldername = preg_replace('~^(\s*)(.*?)(\s*)$~m', "\\2", $foldername);
$foldername = ereg_replace("[^[:alnum:] ]","-",$foldername);
$foldername = preg_replace('/\s\s+/', ' ', $foldername);
which, as far as i can tell, makes appropriate folder names.
thanks again, j