title: How can I allow single underscores only with preg_match?
body: <p>How can I allow single underscores only with preg_match?</p>
  
  <p>The regex I made below takes double underscores which is not I want...</p>
  
  <pre><code>if(!preg_match('/^[a-z0-9\s\_]+$/', $name))
      {
          $error = true;
          echo '&lt;error elementid="name" message="name - please use alpha-numbers and lowercaps only." /&gt;';
      }
  </code></pre>
  
  <p>For instance,</p>
  
  <pre><code>hello world                  ok
  hello_world                  ok
  hello__world                 not ok
  hello_world__again__         not ok
  _hello_world_again_          not ok
  </code></pre>