Re: need help with parsing form input ...
| From: | Justin French | Date: | Wed, 12 Mar 2003 00:19:40 +0000 |
| Subject: | Re: need help with parsing form input ... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139199@lists.php.net to get a copy of this message | ||
Space at the beginning or end of a string can be removed with trim().
In order for someone to write you a regexp, you need to change your question
to the following:
"
I need to ensure a string only has the following characters in it:
A-Z
a-z
0-9
Can someone please help me write a regexp which strip out all other
characters from a string?
"
It's always better to specify what you will ALLOW rather than trying to
think of everything little character you want to REFUSE.
Unfortunately, I'm no good with regexp's, so you'll have to hope someone who
IS reads your post :)
Justin French
on 12/03/03 5:14 AM, Kenn Murrah (kenn@thebytebusiness.com) wrote:
> Greetings.
>
> I'm out of my league here, not knowing enough about regular expressions yet
> to do this, so I desperately need someone's help ...
>
> I need to parse form input to eliminate unwanted characters (punctuation,
> mostly) ... for instance, if the web site visitor types " smith,susan--33"
> into the field, i want to parse that line to eliminate the initial space,
> the comma, and the dashes so that $myvariable=smithsusan33" ....
>
> any help in doing this would be GREATLY appreciate.
>
> thanks.
>
>