title: Regex for partial path
body: <p>I have paths like these (single lines):</p>
  
  <pre><code>/
  /abc
  /def/
  /ghi/jkl
  /mno/pqr/
  /stu/vwx/yz
  /abc/def/ghi/jkl
  </code></pre>
  
  <p>I just need patterns that match up to the third "/".  In other words, paths containing just "/" and up to the first 2 directories.  However, some of my directories end with a "/" and some don't.  So the result I want is:</p>
  
  <pre><code>/
  /abc
  /def/
  /ghi/jkl
  /mno/pqr/
  /stu/vwx/
  /abc/def/
  </code></pre>
  
  <p>So far, I've tried <code>(\/|.*\/)</code> but this doesn't get the path ending without a "/".</p>