Re: Alphanumeric Strings
| From: | Jason Granum | Date: | Thu, 14 Sep 2000 22:46:47 +0000 |
| Subject: | Re: Alphanumeric Strings | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16854@lists.php.net to get a copy of this message | ||
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