How can i get the path and host a url using regexp in postgres
<pre><code>select 
regexp_substr(uri, 'http://([^/]*)') as domainname,
regexp_substr(uri, '[^"http://[a-zA-Z0-9]*"].*') as path, 
uri from http where uri;
</code></pre>

<p>Here is what I have tried already. But the path is not working. (host is not fool proof, but for my test that enough.</p>

<p>PS : as for the path its enough to have content upto last /, no need to go upto ? mark. </p>

<p>Edit : Example</p>

<p>Given a Url like following :
<a href="http://assets.adobedtm.com/a/b/c/041.js" rel="nofollow">http://assets.adobedtm.com/a/b/c/041.js</a></p>

<p>I like to get the </p>

<ul>
<li>host : <a href="http://assets.adobedtm.com" rel="nofollow">http://assets.adobedtm.com</a> </li>
<li>path : a/b/c</li>
</ul>