PHP Regex for password: minim 4 charaters, of which at least one CAN'T be a letter or a number : <p>I have to make a regex for a password with the following conditions:
- minimum 4 characters
- at least 1 non-word character.</p>

<p>I tried this way:</p>

<pre><code>$regex_password  = '@(\W)+@';
$regex_password1 = '@(?i)([a-z\d])+@';

if ((!preg_match($regex_password, trim($_POST['pass']))) &amp;&amp; (!preg_match($regex_password1, trim($_POST['pass']))) &amp;&amp; strlen(trim($_POST['pass'])) &lt;5){
//error
}
</code></pre>

<p>And then tried to create a new account with the password: "pas" and it's working, so there's something wrong with my regex. Can someone help?</p>
