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? Link to comment https://forums.phpfreaks.com/topic/16386-how-would-i/ 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] Link to comment https://forums.phpfreaks.com/topic/16386-how-would-i/#findComment-68326 Share on other sites More sharing options...
Chevy Posted August 3, 2006 Author Share Posted August 3, 2006 Oh yeaa :D Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/16386-how-would-i/#findComment-68664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.