title: How to include hypens and apostrophes for a PHP Regex?
body: <p>I'm writing a password regex in PHP that should return false for any string that has at least <strong>one</strong> character that is not:</p>
  
  <ul>
  <li>a lowercase letter <b>a-z</b></li>
  <li>an uppercase letter <b>A-Z</b></li>
  <li>a number <b>0-9</b></li>
  <li>a whitespace <b>" *"</b></li>
  <li>a punctuation symbol <b>:,.!().?";</b></li>
  </ul>
  
  <p>So far I have this: </p>
  
  <pre><code>    &lt;?php
  
      $password = 'azAZ0  giggles   9*":,.!()    .?";';
      $regex1 = '#^[a-zA-Z0-9" *":,.!().?";\']+$#i';
  
      if (preg_match($regex1, $password)) {
          echo "A match was found.";
      } else {
          echo "A match was not found.";
      }
      ?&gt;
  </code></pre>
  
  <p>Does this seem to be working as I intend it to, or do you see any glaring errors?</p>
  
  <p>And what should I add to the regex so that it should return false for any string that has at least <strong>one</strong> character that is not:</p>
  
  <ul>
  <li>a hyphen <b>-</b></li>
  </ul>