Re: eregi and alfa numeric characters.
| From: | Jimmy | Date: | Fri, 11 Jan 2002 09:53:54 +0000 |
| Subject: | Re: eregi and alfa numeric characters. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80182@lists.php.net to get a copy of this message | ||
Hi Sait,
> no characters except for the followings will not be allowed.
> 0-9 a-z A-Z ~ @ # $ % ( ) _ - + = [ ] { } < ? >
if ( ereg("[^0-9a-zA-Z\_\-]", $user_input) ) {
//invalid char detected
}
else {
//input contain only allowed char
}
just add all your valid char in the pattern, and dont forget
to escape the char which has special meaning in regex.
--
Jimmy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Money is what you make it - a servant or a master