Jump to content

Preg_Match @ %


harkly

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/270128-preg_match/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.