title: Get only unique matches using lookahead
body: <p>I have some debug output from compiler (gcc) listing all include directories it used:</p>
  
  <pre><code>......... /usr/include/boost/serialization/traits.hpp
  ....... /usr/include/boost/serialization/split_member.hpp
  ....... /usr/include/boost/serialization/base_object.hpp
  ........ /usr/include/boost/serialization/force_include.hpp
  ........ /usr/include/boost/serialization/void_cast_fwd.hpp
  ....... /usr/include/boost/serialization/wrapper.hpp
  </code></pre>
  
  <p>It's over 3000 lines, all of which look kind of like this. I would like to get a list of dependencies loaded, but of course, one per path. Something like:</p>
  
  <pre><code>/usr/include/boost/
  /usr/local/include/log4cplus/
  </code></pre>
  
  <p>So far I made this: <a href="https://regex101.com/r/gM3aW4/1" rel="nofollow">https://regex101.com/r/gM3aW4/1</a></p>
  
  <pre><code>\.+\s((?:\/[a-z]+)+)\/(include|lib)\/([a-z0-9\+]+)
  </code></pre>
  
  <p>It properly matches and provides you with paths, but lists them repetitively. I've seen somebody using lookahead expressions <code>(?! ... )</code> on this. I tried "putting" <code>\1-3</code> references into lookahead to prevent matching path that can be matched later but I allways either get all paths or non.</p>
  
  <p>I understand lookahead is slow, but performance is not a matter since I'll run this regex manually once in a long time.</p>