millercj Posted March 22, 2008 Share Posted March 22, 2008 Hi everyone, I'm having some issues with a script. I want it to examine a string and simply report a true/false whether there are special characters in the string. I found an example on line and tried to adapt it to what i'm tryig to do but no matter the input it is spitting out a 0 This is what i have <?PHP $input=$_POST['input']; $review = preg_match('/!@#$%^&*()/',$input); echo $review; ?> Quote Link to comment Share on other sites More sharing options...
marun Posted March 22, 2008 Share Posted March 22, 2008 Yuo should change your regexp: $review = preg_match('/[!@#$%^&*()]/', $input); This will match when any of '!@#$%^&*()' will be present at $input. Quote Link to comment Share on other sites More sharing options...
millercj Posted March 22, 2008 Author Share Posted March 22, 2008 Thanks! it worked great Quote Link to comment 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.