preg_match problem

From: Date: Mon, 22 Jan 2007 23:04:24 +0000
Subject: preg_match problem
Groups: php.general 
Request: Send a blank email to php-general+get-247582@lists.php.net to get a copy of this message
I'm trying to get this but not quite there. I want to allow the following characters. A-Za-z0-9!@#$%&()*;:_.'/\ and a space. Is there a special order these need to be in or escaped somehow. For example, if I just allow _' the ' is fine, if I add the other characters, the ' gets preceded by a \ and an error is returned. If I take the ' out of the sting below it works fine, I get no errors returned. I am also using stripslashes on the variable. This is my code. (although I have tried various things with it trying to get it right) if(preg_match("/^[-A-Za-z0-9!@#%&\(\)\*;:_.\'\$ ]+$/", $string)) { Thanks

« previous php.general (#247582) next »