PDA

View Full Version : preg_match not checking whole string


harmor19
02-27-2006, 09:38 PM
I took this preg_match from this one site
if(preg_match("/[^a-zA-Z0-9\.\-\?\?\?\?\?\?\?\ ]+$/s",$_POST['susername']))
{
eval(standard_error(fetch_error('illegal_character ')));
}

If I just type "@" in the field it recognizes it but if I were to type "s@s" it doesn't recognize it.

Marco van Herwaarden
02-28-2006, 12:59 PM
Try removing the +$

harmor19
02-28-2006, 01:33 PM
Thanks but I got it working.

I looked at one for email and I modified it.

if(!preg_match("/^[a-zA-Z0-9_\.\-]+$/",$db->escape_string($vbulletin->GPC['susername'])))
{
eval(standard_error(fetch_error('illegal_character ')));
}