title: Using a C# regex to parse a domain name?
body: <p>I need to parse the domain name from a string. The string can vary and I need the exact domain.</p>
  
  <p>Examples of Strings:</p>
  
  <pre><code>http://somename.de/
  www.somename.de/
  somename.de/
  somename.de/somesubdirectory
  www.somename.de/?pe=12
  </code></pre>
  
  <p>I need it in the following format with just the domain name, the <code>tld</code>, and the <code>www</code>, if applicable:  </p>
  
  <pre><code>www.somename.de
  </code></pre>
  
  <p>How do I do that using C#?</p>