title: Extract URL minus path in Google Sheets
body: <p>Unlike some other questions, which want to turn URLs into root domains (eg <code>https://www.example.com/foo</code> to <code>example.com</code>)...</p>
  
  <p>I would like to retain the protocol and subdomain (everything leading up to the single slash following the TLD, should there be one).</p>
  
  <p>Eg. <code>https://www.example.com/foo</code> to <code>https://www.example.com</code></p>
  
  <p>I tried this but got a really weird result (haha)!</p>
  
  <p><code>=REGEXEXTRACT(C2,"(https?:\/\/(www.)?[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+)\/")</code></p>
  
  <p>It works, sort of, but <strong>look what happens!!</strong> It inserts data in the next column (huh??). What's crazier, when I delete the data it breaks the formula! I have done something very wrong.</p>
  
  <p><a href="https://i.stack.imgur.com/51oxZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/51oxZ.png" alt="enter image description here"></a></p>
  
  <p>Here is my sheet for testing: <a href="https://docs.google.com/spreadsheets/d/1axNd6WZJnGIC8Ydyir58twrIhRhb-p1npNeg3SHfDBg/edit#gid=0" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1axNd6WZJnGIC8Ydyir58twrIhRhb-p1npNeg3SHfDBg/edit#gid=0</a></p>