title: Regex that only matches when no duplicate lines are found
body: <p>I have a multiline string like this:</p>
  
  <pre><code>SA21 abcdef
  BKxyz
  SA21 abcdef
  </code></pre>
  
  <p>I need a regex that only matches if the line <code>^SA21 abcdef$</code> is present once. So it should not match for the first example but it should match for this one:</p>
  
  <pre><code>BK udsia
  SA21 abcdef
  BKxyz
  </code></pre>
  
  <p>I tried to capture the line and make sure it matches only when the same line is not found later: <code>/(^SA21 abcdef$)(?!\1)/m</code> <a href="https://www.regex101.com/r/nS8sD8/1" rel="nofollow">regex101</a> but that does not work as it will probably always match the last line... </p>