I think I'm looking for something like this:
$dirnamewanted = ereg_replace("^[[:alnum:]]+$" $_POST['dirnamewanted']);
Problem is that this crashes my script. I am so tired of this thing...
--- In [email protected], "Bob" <[EMAIL PROTECTED]> wrote:
> Hi Marian,
> Is this what you're looking for?
>
> <?php
> $raw = "$$$ %mysite% #!$@ 123 #!$@ $$$";
> $raw = preg_replace('/\W/', '', $raw);
> echo $raw;
> ?>
>
>
> ----- Original Message -----
> From: "Marian Briones" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Sunday, August 07, 2005 3:44 PM
> Subject: [php-list] Getting rid of unwanted characters in a string
>
>
> >I have a function where users can upload their photos to a photo area.
> > I can't seem to find a good way to strip unwanted characters out of
> > the filename. I also need this to work when they are choosing a
> > username for their webspace.
> >
> > It is coming in off a form submission. I don't want any spaces, and
> > alpha numeric characters only. For the filename of the photo, I know
> > I can just copy that up to the server with an identifier, but for the
> > incoming username on the form, I already had someone thinking they
> > were smooth by putting in a URL like www.theircompany.com for their
> > desired webspace name. No no no. I want to make sure the .'s are
> > stripped out of there and if they have spaces or characters like
#!$@ etc.
> >
> > WHat is the syntax to do this? And what function? ereg_replace?
> >
> > I hope I am clearer than I have been in the past at explaining what it
> > is I want to do.
> >
> > Thank you...
> >
> > Marian
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hq40qmt/M=362131.6882499.7825260.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1123512766/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/