title: RegEX: match ([^A-Z]*) but stop if you find "foo"
body: <p>I ran into a problem that I can't figure out how to fix.
  I have a series of video files with names like this:</p>
  <pre><code>FooBar-tooGGG1 - s01e01 - (HW) - SomeText.mp4
  </code></pre>
  <p>So I have to make sure that spaces are added before capital letters BUT ONLY until &quot;- s01e&quot; appears (thus ignoring the rest of the text):</p>
  <pre><code>Foo Bar-too GGG 1 - s01e01 - (HW) - SomeText.mp4
  </code></pre>
  <p>Looking around I stumbled upon these RegEX:</p>
  <pre><code>(?-i)([A-Z]{1})([^A-Z]*)
  </code></pre>
  <p>Replace with: <code>$1$2 </code></p>
  <hr />
  <pre><code>.+?(?=abc)
  </code></pre>
  <p>or</p>
  <pre><code>\w*(?&lt;!foo)bar
  </code></pre>
  <p>or</p>
  <pre><code>^(?:(?!foo).)*
  </code></pre>
  <p>and this played a little bit on Regex101 but I can't end up getting only two types of results:</p>
  <pre><code>(?-i)([A-Z]{1})([^A-Z]*.+?(?= - s01e))
  </code></pre>
  <p>or</p>
  <pre><code>(?-i)([A-Z]{1})([^A-Z]*)/g
  </code></pre>
  <p>Respectively:</p>
  <pre><code>F ooBar-tooGGG1 - s01e01 - (HW) - SomeText.mp4
  </code></pre>
  <p>and</p>
  <pre><code>Foo Bar-too GGG1 - s01e01 - ( H W) -  Some Text.mp4
  </code></pre>
  <p>I'm not very good at RegEx but I've been trying everything since this morning, put in the middle, use +? instead of * o. * etc.</p>
  <p>RegEX Engine: PCRE2; PCRE.
  If bulk rename doesn't fit as software, I also have:
  FlexibleRenamer and RegexRenamer (also for Windows)</p>