October 9th, 2000, 11:38 AM
I'm creating a web forum using php and mysql. The users have to register before they can post anything to the forum, thus they must choose a username. Has anybody wrote or seen a piece of code that checks if a string contains special characters? I want the username to be strictly numeric. Does anybody know how to do this with a regular expression?
October 9th, 2000, 11:41 AM
do you mean strictly alphanumeric?
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>if(preg_match("/[^w]/", $var))
// $var not ok
// $var ok
[This message has been edited by RyanP (edited October 09, 2000).]