Baby's First Regex!

From: Date: Tue, 09 Jan 2001 01:52:11 +0000
Subject: Baby's First Regex!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33368@lists.php.net to get a copy of this message
Hi all. I have written my first regex's, which are simply used for validation of input into a web form. Basically, they check to see if an invalid characters are being entered, and is working perfectly. A different regex is used to different types of input. They are as follows $Status = (ereg("^[A-Za-z0-9` !@#$%&()=:;\"\'.?/-]*$", $String)); A-Z a-z 0-9 - ` [SPACE] ! @ # $ % & ( ) = \ : ; " ' . ? / $Status = (ereg("^[0-9 +-]*$", $String)); 0-9 [SPACE] + - $Status = (ereg("^[A-Za-z' -]*$", $String)); A-Z a-z - ' [SPACE] $Status = (ereg("^[A-Z_]*$", $String)); A-Z _ $Status = (ereg("^[A-Z ]*$", $String)); A-Z [SPACE] $Status = (ereg("^[0-9 ]*$", $String)); 0-9 [SPACE] $Status = (ereg("^[A-Za-z0-9` @#$%&()=:;\"\'.?/-]*$", $String)); At the moment, the error message sent to the browser is along the lines of "You have entered invalid characters. Please check and try again." However, I would rather be able to tell them WHICH characters they entered represent a problem. How can I get a the list of characters tht causes one of these regex's to fail? ====================================================================== Murray Shields Email: murray@globalcat.com.au MU Systems Pty Ltd Phone: +61 7 3351 6677 Global Catalogs Pty Ltd Phone: +61 7 3351 4777

« previous php.general (#33368) next »