title: write an ng-pattern to disallow whitespaces and special characters
body: <p>I am trying to get an angular ng-pattern to check that a username has no whitespaces or special characters. The following form return false if you enter whitespaces or special characters. However, it becomes true as soon as you enter a-z, A-z or 0-9. I have tried ng-pattern="/[^\s]+/" and \S and [^ ] but they make no difference.</p>
  
  <pre><code>&lt;form name="myform"&gt;
    valid? {{ myform.$valid }}
    &lt;input type="text" name="username" ng-model="username" ng-pattern="/[a-zA-Z0-9^ ]/" required/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here's the form in a plunk: <a href="http://plnkr.co/edit/6T78kyUgXYfNAwB4RHKQ?p=preview">http://plnkr.co/edit/6T78kyUgXYfNAwB4RHKQ?p=preview</a></p>