RE: [PHP] regexp question
| From: | Christensen, BruceX R | Date: | Fri, 11 Aug 2000 19:05:45 +0000 |
| Subject: | RE: [PHP] regexp question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11383@lists.php.net to get a copy of this message | ||
How about:
ereg('^[[:alnum:]_-]+$')
See http://www.cs.utah.edu/dept/old/texinfo/regex/regex.html
for an
explanation of the [:alnum:]. For a quick intro to regexs see
http://hotwired.lycos.com/webmonkey/97/33/index3a.html.
For a more in-depth
look, see:
http://etext.lib.virginia.edu/helpsheets/regex.html
http://www.perl.com/pub/doc/manual/html/pod/perlre.html
And for a /really/ in-depth look at how these things work, see:
http://www.oreilly.com/catalog/regex/chapter/ch04.html
--Bruce
Bruce Christensen
Intel Corporation
brucex.r.christensen@intel.com
-----Original Message-----
From: Ryan J Nichols [mailto:ryan@globali.net]
Sent: Friday, August 11, 2000 11:43 AM
To: php-general@lists.php.net
Subject: [PHP] regexp question
can I get a regexp that verifies a string is only 0-9 a-z A-Z or contains _
and -
ereg("^[^A-Za-z0-9\d_-]+$",$bah)
does not work.
I've been toying with this for a while with no success, in addition to the
answer a nice url to a tutorial on these things would be appreciated.
Thanks in advance,
Ryan