I am using this code which works fine in stripping the http://
part.
<?php $str = get_field('fl_website');$str = preg_replace('#^https?://www.#', '', rtrim($str,'/'));echo $str; ?>
However I need to also strip any second-level links and only keep the main domain name.
For example:
https://www.example.com/sites/annabel/2016/03
needs to be converted to just:
example.com