harkly Posted October 31, 2012 Share Posted October 31, 2012 (edited) Never mind I got it Not sure if this is a regex issue or a preg_match code issue Have this function and I cannot use the @ or the % in a new password function newPswdChar($newPswd) { if (preg_match('/^[a-z0-9@!#%]+$/i',$newPswd)) return FALSE; else return TRUE; } But goes thru the Javascript check fine var alphaExpression = /^[a-z0-9@!%#]+$/i; if(!form.newPswd.value.match(alphaExpression)) { alert("Error: Invalid characters where used!"); form.newPswd.focus(); return false; } I just want to allow letters, numbers and @ ! % #. I looked and looked at the regex stuff and it seems to point to me having it correct. Can someone help me with this? Edited October 31, 2012 by harkly Quote Link to comment https://forums.phpfreaks.com/topic/270128-preg_match/ Share on other sites More sharing options...
ManiacDan Posted October 31, 2012 Share Posted October 31, 2012 Why are you stopping me from using ~, ^, and * in my passwords? What is with people and their ridiculous password limitations recently? Just make sure it's 6 characters or more, and be done with it. Quote Link to comment https://forums.phpfreaks.com/topic/270128-preg_match/#findComment-1389114 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.