title: Regex match character only when NOT preceeded by specific word
body: <p>The goal is to have regex match all newline character which are not preceded by a 2-decimal number. Here's some example text:</p>
  <pre><code>This line ends with text
  this line ends with a number: 55
  this line ends with a 2-decimal number: 5.00
  here's 22.22, not at the end of the line
  </code></pre>
  <p>Regex should match the end of lines 1, 2, and 4 (assuming a newline after the 4th line).  I thought negative lookahead was the answer so I tried</p>
  <pre><code>(?!\d*\.\d\d)\n
  </code></pre>
  <p>without success as seen in this regex101 snippet: <a href="https://regex101.com/r/qbrKlt/4" rel="nofollow noreferrer">https://regex101.com/r/qbrKlt/4</a></p>
  <blockquote>
  <p><s>Edit: I later discovered the reason this didn't work is because Python's Regex doesn't support variable length negative lookahead - it only supports fixed-length negative lookahead.</s></p>
  </blockquote>
  <p>Unfortunately fixed-length look-ahead still didnt work:</p>
  <pre><code>(?!\.\d\d)\n
  </code></pre>
  <p>Instead I did a workaround by running regex twice &amp; subtracting the result:</p>
  <ol>
  <li>find all indices of newline characters: <code>\n</code></li>
  <li>find all indices of newline characters preceded by 2-decimal numbers: <code>\d*\.\d\d\n</code></li>
  <li>remove indices found in step 2 from those found in step 1 for the answer</li>
  </ol>
  <p>But I'm sure there's a way to do this in 1 go and I'd be grateful to anyone out there that can help in discovering the solution :)</p>