matthewlesh Posted May 26, 2007 Share Posted May 26, 2007 i know this is kinda dume but i am a newbie and working on a username validating system... and it needs to do the following things... Only allow lowercase letters Allow numbers Allow "_" and "$" and not allow anything else... and if it does not go by this print an error out. Please help:D Link to comment https://forums.phpfreaks.com/topic/53031-just-some-help-related-to-preg_replace/ Share on other sites More sharing options...
neel_basu Posted May 26, 2007 Share Posted May 26, 2007 First of all you should post it in regex forum ------------------------------------------------------------- Your subject is "Just some help related to preg_replace()" But there is nothing about replacing in your Question Its all about ereg() and preg_match() -------------------------------------------------------------- Use this regex with ereg() or preg_match() [0-9_\$]+ Link to comment https://forums.phpfreaks.com/topic/53031-just-some-help-related-to-preg_replace/#findComment-261966 Share on other sites More sharing options...
Psycho Posted May 26, 2007 Share Posted May 26, 2007 <?php if (ereg("^[a-z0-9_\$]+$", $username)) { echo "Valid"; } else { echo "Not Valid"; } ?> Link to comment https://forums.phpfreaks.com/topic/53031-just-some-help-related-to-preg_replace/#findComment-261969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.