title: Regex for tags separated by spaces/commas, up to n tags
body: <p>I would like to validate a user's input of indexing tags for posts by running them through a regular expression in Codeigniter's validation library.</p>
  
  <p>Ideally, the regex would have the following conditions:</p>
  
  <ol>
  <li>allow only letters and numbers</li>
  <li>tags will be considered unique entities if separated by space (any number) or comma (any number)</li>
  <li>there should be a limit to the number of tags (for ex in this case 6)</li>
  </ol>
  
  <p>There are a few partial solutions to this here on SO:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4310141/regex-for-alphanumeric-tags-separated-by-commas">For alphanumeric tags separated by commas?</a></li>
  <li><a href="https://stackoverflow.com/questions/6165338/regex-for-comma-separated-text">Regex for comma separated text</a></li>
  </ul>
  
  <p>but they do not fully resolve my issue.</p>
  
  <p>Any suggestions?</p>