If you end up on this page and you are looking for the best REGEX of URLS try this one:
^(?:https?:)?(?:\/\/)?([^\/\?]+)
https://regex101.com/r/pX5dL9/1
It works for urls without http:// , with http, with https, with just // and dont grab the path and query path as well.
Good Luck