title: php preg_match() code for comma separated names
body: <p>I need to validate input patterns using <code>preg_match()</code> so that the patterns is like " anyname1,anyname2,anyname3, ".  </p>
  
  <p>Note that there is a comma at the end too. Any letter or number is valid between the commas, numbers do not have to appear at the end.  e.g  "nam1e,Na2me,NNm22," is valid. </p>
  
  <p>I tried <code>^([A-Za-z0-9] *, *)*[A-Za-z0-9]$</code> but did no work. I have gone through other posts too but did not get a perfect answer. </p>
  
  <p>Can someone give me an answer for this?</p>