title: Python regular expression to remove space and capitalize letters where the space was?
body: <p>I want to create a list of tags from a user supplied single input box, separated by comma's and I'm looking for some expression(s) that can help automate this.</p>
  
  <p>What I want is to supply the input field and:</p>
  
  <ul>
  <li>remove all double+ whitespaces, tabs, new lines (leaving just single spaces)</li>
  <li>remove ALL (single's and double+) quotation marks, except for comma's, which there can be only one of</li>
  <li>in between each comma, i want Something Like Title Case, but excluding the first word and not at all for single words, so that when the last spaces are removed, the tag comes out as 'somethingLikeTitleCase' or just 'something' or 'twoWords'</li>
  <li>and finally, remove all remaining spaces</li>
  </ul>
  
  <p>Here's what I have gathered around SO so far:</p>
  
  <pre><code>def no_whitespace(s):
  """Remove all whitespace &amp; newlines. """
      return re.sub(r"(?m)\s+", "", s)
  
  
  # remove spaces, newlines, all whitespace
  # http://stackoverflow.com/a/42597/523051
  
    tag_list = ''.join(no_whitespace(tags_input))
  
  # split into a list at comma's
  
    tag_list = tag_list.split(',')
  
  # remove any empty strings (since I currently don't know how to remove double comma's)
  # http://stackoverflow.com/questions/3845423/remove-empty-strings-from-a-list-of-strings
  
    tag_list = filter(None, tag_list)
  </code></pre>
  
  <p>I'm lost though when it comes to modifying that regex to remove all the punctuation except comma's and I don't even know where to begin for the capitalizing.</p>
  
  <p>Any thoughts to get me going in the right direction?</p>
  
  <hr>
  
  <p>As suggested, here are some sample inputs = desired_outputs</p>
  
  <p>form: 'tHiS iS a tAg, 'whitespace'  !&amp;#^   , secondcomment     , no!punc$$, ifNOSPACESthenPRESERVEcaps'  should come out as
      ['thisIsATag', 'secondcomment', 'noPunc', 'ifNOSPACESthenPRESERVEcaps']</p>