Chevy Posted August 2, 2006 Share Posted August 2, 2006 How would I got about banning spaces? [code]if (!ereg ("([0-9a-zA-Z_])", $username)) {[/code]thats all I want to allow is 0-9, a-z, A-Z and _'s....but spaces somehow find there way threw....can you help me? Quote Link to comment Share on other sites More sharing options...
effigy Posted August 3, 2006 Share Posted August 3, 2006 You didn't use anchors. [code]!preg_match('/^\w+$/', $string)[/code] Quote Link to comment Share on other sites More sharing options...
Chevy Posted August 3, 2006 Author Share Posted August 3, 2006 Oh yeaa :D Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.