title: PHP Regular Expressions being ignored / validating true
body: <p>Bear with me, as I'm quite new to using regular expressions.</p>
  
  <p>I have regexp checks on three fields, as marked in my code below. No matter what I enter in the fields, neither my <em>character length</em> restrictions, nor my actual <em>character</em> restrictions are enforced; all of these fields seem to simply "skip over" my regular expression checks and validate as true.</p>
  
  <pre><code>// NAME
      if (preg_match('%^[A-Za-z\.\' \-]{12,80}$%', stripslashes($name)) === false) {
          $name = false;
          $errors[] = 'You need to enter a valid name. No slashes or quotes are allowed.';
      }
      else { echo 'Test: RegExp Validation passed for "NAME" &lt;br /&gt;'; }
  
  // PHONE NUMBER
      if (preg_match('%^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$%', $phone) === false) {
          $phone = false;
          $errors[] = 'A valid phone number must be entered. Only numbers, dashes, and parentheses are allowed';
      }
      else { echo 'Test: RegExp Validation passed for "PHONE" &lt;br /&gt;'; }
  
  //EXTENSION
      if (!empty($phnext) &amp;&amp; preg_match('%^[0-9]{3,5}$%', $phnext) === false) {
          $phnext = false;
          $errors[] = 'Only 3 to 5 numbers are allowed for the phone extension.';
      }
      else { echo 'Test: RegExp Validation passed for "EXTENSION" &lt;br /&gt;'; }
  </code></pre>
  
  <p>I don't get any syntax, compilation, or out-of-range errors. So I'm wondering, are my actual regexp strings wrong, or is my logic wrong somewhere? It wouldn't be the first time. I'm just a little stumped.</p>