Re: Alphanumeric Strings
| From: | Hans H. Anderson | Date: | Thu, 14 Sep 2000 23:34:26 +0000 |
| Subject: | Re: Alphanumeric Strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16866@lists.php.net to get a copy of this message | ||
Jason,
Try ereg("[^A-Za-z0-9]",$string);
Hans
On Thu, 14 Sep 2000, Jason Granum wrote:
> This returns true though if the string is "This is a @#&$#@#% test"
> Alphanumeric should only be a-z 0-9 and _ correct?
>
> ----- Original Message -----
> From: Lars Torben Wilson <torben@pinc.com>
> To: Jason Granum <razm@caesius.com>
> Cc: <php-general@lists.php.net>
> Sent: Thursday, September 14, 2000 3:31 PM
> Subject: Re: [PHP] Alphanumeric Strings
>
>
> > Jason Granum writes:
> > > I can't seem to find the regex I'm looking for here. If anyone could
> > > point me in the right direction. I'm trying to see if a string
> > > contains ONLY alphanumeric characters. Is there an easy regex to
> > > find this out? Tnx
> > >
> > > --------------------------
> > > Jason Granum
> >
> > if (ereg('[[:alnum:]]', $string)) {
> > /* do something */
> > }
> >
> > --
> > +----------------------------------------------------------------+
> > |Torben Wilson <torben@php.net> Netmill iTech|
> > |http://www.coastnet.com/~torben
> > http://www.netmill.fi|
> > |Ph: 1 250 383-9735 torben@netmill.fi|
> > +----------------------------------------------------------------+
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
--
Hans Anderson -=- me@hansanderson.com
http://www.hansanderson.com | PHP, SQL Databases, Flash 5
Animation &
http://www.goofiness.com | Programming, Audio Production,
Brewmeister.