preg_match to allow specific special characters in string
<p>How can i achieve that password have (backward slash,forward slash,single quote,double quotes) then and then only it will not allow else it will return true using custom validation.i don't have much idea about preg_match so all suggestions are acceptable.</p>

<p>I have tried below code to achieve that but can't get success.</p>

<p>So anyone have some suggestions/idea ?</p>

<p>php code :</p>

<pre><code>    public function check_password($str){
        return ( !preg_match("/^[a-z0-9!@#$%^&amp;*()_-+|;:&lt;&gt;,.?]+$/i", $str)) ? FALSE : TRUE;
    }
</code></pre>

<p>if i will put exclude(backward slash,forward slash,single quote,double quotes) then it must allow me to store password in database</p>

<p>For example :</p>

<pre><code>Password  : !@#$%^&amp;*()_-+| ;:&lt;&gt;, // true
Password  : /12345               //false
Password  : 1Aa3!@#$%^&amp;*()_-+| ;:&lt;&gt; //true(here white space also allowed)
</code></pre>