PDA

View Full Version : Regex and ereg()


ekrub
03-07-2007, 08:29 AM
I'm designing a form that must have regex validation in an application, but I'm not sure of the capacity of ereg, and I am also looking for regex to validate:


Field is not empty
Alphanumeric field
One of a few chosen strings


can anyone help?

Nook Schreier
03-07-2007, 05:57 PM
Up front, I will admit almost complete ignorance with regex. I have heard of it and know what it does, but that's it. I've never seen much use in it personally, because it's so complicated and the same thing can be done with other, easier, methods. But with some googling, I found some links that might help.
Regular Expressions PHP Tutorial (http://weblogtoolscollection.com/regex/regex.php)
Using Regular Expressions with PHP (http://www.regular-expressions.info/php.html)
PHP: preg_match - Manual (http://us2.php.net/preg-match)