I've got a large database of projects and issue trackers, some of which have urls.
I'd like to query it to figure out a list of urls for each project, but many have extra data I'd like to avoid.
I'd like to do something like this:
substring(tracker_extra_field_data.field_data FROM 'http://([^/]*).*')
Except some urls are https, and I'd like to capture that as well as the first sub directory.
For example, given the url:
https://dev.foo.com/bar/action/?param=val
I'd like the select to return:
https://dev.foo.com/bar/
Is there a semi-simple way to do this with substring/regex in pgsql?