title: Split a string at uppercase letters, but only if a lowercase letter follows in Python
body: <p>I am using pdfminer.six in Python to extract long text data. Unfortunately, the Miner does not always work very well, especially with paragraphs and text wrapping. For example I got the following output:</p>
  <pre><code>&quot;2018Annual ReportInvesting for Growth and Market LeadershipOur CEO will provide you with all further details below.&quot;
  
  --&gt; &quot;2018 Annual Report Investing for Growth and Market Leadership Our CEO will provide you with all further details below.&quot;
  </code></pre>
  <p>Now I would like to insert a space whenever a lowercase letter is followed by a capital letter and then a smaller letter (and for numbers). So that in the end <code>&quot;2018Annual&quot;</code> becomes <code>&quot;2018 Annual&quot;</code> and <code>&quot;ReportInvesting&quot;</code> becomes <code>&quot;Report Investing&quot;</code>, but <code>&quot;...CEO...&quot;</code> remains <code>&quot;...CEO...&quot;</code>.</p>
  <p>I only found solutions to <a href="https://stackoverflow.com/questions/2277352/split-a-string-at-uppercase-letters">Split a string at uppercase letters</a> and <a href="https://stackoverflow.com/a/3216204/14635557">https://stackoverflow.com/a/3216204/14635557</a> but could not rewrite it. Unfortunately I am totally new in the field of Python.</p>