Ensure all the domains have http:// prefix
Use the formula:
=IF(ISERROR(FIND("//www.",A2)), MID(A2,FIND(":",A2,4)+3,FIND("/",A2,9)-FIND(":",A2,4)-3), MID(A2,FIND(":",A2,4)+7,FIND("/",A2,9)-FIND(":",A2,4)-7))
Stolen the formula from here:
You can download a template spreadsheet here:
domainfromurl2