title: Python: convert camel case to space delimited using RegEx and taking Acronyms into account
body: <p>I am trying to convert camel case to space separated values using python.  For example: </p>
  
  <blockquote>
    <p>divLineColor -> div Line Color</p>
  </blockquote>
  
  <p>This line does that successfully: </p>
  
  <pre><code>label = re.sub("([A-Z])"," \g&lt;0&gt;",label)
  </code></pre>
  
  <p>The problem I am having is with things like <code>simpleBigURL</code> they should do this:</p>
  
  <blockquote>
    <p>simpleBigURL -> simple Big URL</p>
  </blockquote>
  
  <p>I am not entirely sure how to get this result.  Help!</p>
  
  <hr>
  
  <p>This is one thing that I tried: </p>
  
  <pre><code>label = re.sub("([a-z])([A-Z])","\g&lt;0&gt; \g&lt;1&gt;",label)
  </code></pre>
  
  <p>But this produces weird results like: </p>
  
  <blockquote>
    <p>divLineColor -> divL vineC eolor</p>
  </blockquote>
  
  <p>I was also thinking that using the <code>(?!...)</code> could work but I have not had any luck.  </p>