title: AngularJs ng-pattern regex
body: <p>I am struggling writing a Regex for angular ng-pattern to validate a form input field.An example of the possible inputs are below</p>
  
  <p>Valid input:</p>
  
  <pre><code>@tag1,@tag2,@tag3
  @tag1, @tag2, @tag3
  @tag1
  </code></pre>
  
  <p>Invalid Input:</p>
  
  <pre><code>@tag 1
  @tag 1, @tag2, @tag  -3
  @ta g1, @t ag2
  </code></pre>
  
  <p>Basically it should allow comma and comma whitespace, but not allow whitespace in between tags.</p>
  
  <p>I have written a REGEX that matches all the invalid input, but when I use this in ng-pattern it does not do the correct validation.</p>
  
  <p>Regex Built: <code>/((^, @|@\s+)|@*[a-zA-Z0-9]* +[a-zA-Z0-9])/g</code>
  Link: <a href="https://regex101.com/r/HMVdLD/1" rel="nofollow noreferrer">https://regex101.com/r/HMVdLD/1</a></p>
  
  <p>Any help is much appreciated!</p>