JustPaste.it
     # Formatted using  htpps://regexformat.com
# ^(?:([A-Za-z]+):)?(/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:/([^?#]*))?(?:\?([^#]*))?(?:\#(.*))?$

     ^ 
     (?:
        ( [A-Za-z]+ )         # (1)
        :
     )?
     ( /{0,3} )               # (2)
     ( [0-9.\-A-Za-z]+ )      # (3)
     (?:
        :
        ( \d+ )               # (4)
     )?
     (?:
        /
        ( [^?#]* )            # (5)
     )?
     (?:
        \? 
        ( [^#]* )             # (6)
     )?
     (?:
        \#
        ( .* )                # (7)
     )?
     $