title: Python Regex on comma, space
body: <p>Say I have a string <code>"Dogs,cats"</code>. If I do <code>re.split(r'[,]*', 'Dogs,cats')</code>, then I get <code>['Dogs', 'cats']</code>, and this is good, but if I get <code>'Dogs, cats'</code>, then I get a list <code>['Dogs', ' cats']</code> and this is bad. How to I make my regex pattern match either having a comma with no space or with a space to still give me <code>['Dogs', 'cats']</code>?</p>
  
  <p>I tried <code>re.split(r'[\s,]*', 'Dogs,cats')</code> and while that works here, it gives an unwanted splitting in the cases where I have a say, <code>'dogs,cats are Happy'</code>.</p>