RE: [PHP] Simple regexp
| From: | Martin Towell | Date: | Fri, 30 Aug 2002 05:17:08 +0000 |
| Subject: | RE: [PHP] Simple regexp | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114602@lists.php.net to get a copy of this message | ||
try this
ereg("^[a-zA-Z0-9:]*$",$string)
all your's is doing is looking for any char in $string that's a-z or A-Z or
0-9 or :
instead of all chars, from start to end, being them
-----Original Message-----
From: Adam Alkins [mailto:adam@rasadam.com]
Sent: Friday, August 30, 2002 3:20 PM
To: PHP List
Subject: [PHP] Simple regexp
Hi,
I'm trying to do a simple regexp to validate if a whole string only contains
the numbers 0 to 9, Letters a - f and A - F and the character :
Why isn't ereg("[a-zA-Z0-9:]",$string) working?
Guidance appreciated.
--------------
Adam Alkins
http://www.rasadam.com
--------------