title: Regex to match text between commas
body: <p>I'm going nuts trying to get a regex to detect spam of keywords in the user inputs. Usually there is some normal text at the start and the keyword spam at the end, separated by commas or other chars.</p>
  
  <p>What I need is a regex to <strong>count the number of keywords</strong> to flag the text for a human to check it.</p>
  
  <p>The text is usually like this:</p>
  
  <pre><code>[random text, with commas, dots and all]
  
  keyword1, keyword2, keyword3, keyword4, keyword5,
  Keyword6, keyword7, keyword8...
  </code></pre>
  
  <p>I've tried several regex to count the matches:</p>
  
  <p>-This only gets one out of two keywords</p>
  
  <pre><code>[,-](\w|\s)+[,-]
  </code></pre>
  
  <p>-This also matches the random text</p>
  
  <pre><code>(?:([^,-]*)(?:[^,-]|$))
  </code></pre>
  
  <p>Can anyone tell me a regex to do this? Or should I take a different approach?</p>
  
  <p>Thanks!</p>