title: Regex Classic ASP
body: <p>I've currently got a string which contains a URL, and I need to get the base URL.</p>
  
  <p>The string I have is <a href="http://www.test.com/test-page/category.html" rel="nofollow">http://www.test.com/test-page/category.html</a></p>
  
  <p>I am looking for a RegEx that will effectively remove any page/folder names at the end. The issue is that some people may enter the domain in the following formats:</p>
  
  <pre><code>http://www.test.com
  www.test.co.uk/
  www.test.info/test-page.html
  www.test.gov/test-folder/test-page.html
  </code></pre>
  
  <p>It must return <a href="http://www.websitename.ext/" rel="nofollow">http://www.websitename.ext/</a> each time i.e. the domain name and extension (e.g. .info .com .co.uk etc) with a forward slash at the end.</p>
  
  <p>Effectively it needs to return the base URL, without any page/folder names. Is there any easy way to do with with a Regular Expression?</p>
  
  <p>Thanks.</p>