Remove all characters from a URL except domain and extensions

waldoctg

New Member
Joined
Jan 4, 2016
Messages
8
This is perfect

Also, can you make one for me to just get rid of any http://; https://; www.; http://www.; https://www.; as well as "/" at the end? Like shown in the example below.

http://bob.woohoo.com bob.woohoo.com
www.bob.woohoo.com/ bob.woohoo.com/
http://www.bill.woohoo.com bill.woohoo.com
https://www.bill.woohoo.com/folder1 bill.woohoo.com/folder1
http://bill.woohoo.com/folder1/ bill.woohoo.com/folder1
https://www.bill.woohoo.com/folder1/folder2 bill.woohoo.com/folder1/folder2
http://www.bill.woohoo.com/folder1/folder2/ bill.woohoo.com/folder1/folder2
http://bill.woohoo.com bill.woohoo.com
www.bill.woohoo.com bill.woohoo.com
bill.woohoo.com bill.woohoo.com
State Information/U.S. Department of Housing and Urban Development (HUD) portal.hud.gov/hudportal/HUD/states
https://mapquest.com/ mapquest.com/
Reference Desk historymatters.gmu.edu/browse/refdesk
https://blast.ncbi.nlm.nih.gov/ blast.ncbi.nlm.nih.gov
http://www.tfl.gov.uk/modalpages/2605.aspx tfl.gov.uk/modalpages/2605.aspx
Marketing Seminars & Webinars | Constant Contact Events constantcontact.com/features/tours.jsp


Moderator edit: Moved from this post to start a new thread.
 
Last edited by a moderator:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi
Try to test with a udf-function, please
Code:
Public Function GetUrlPart(ByVal this As String) As String
    Dim pReg As Object, needed As String
    Set pReg = CreateObject("VBScript.RegExp")
    pReg.IgnoreCase = True
    pReg.Pattern = "(?:https?\://)?(?:www\.)?(.+)"
    needed = pReg.Execute(this)(0).SubMatches(0)
    GetUrlPart = IIf(Right$(needed, 1) = "/", Left$(needed, Len(needed) - 1), needed)
End Function
Regard,
 
Upvote 0
Hi thanks.

I'm looking for something more I just put in the cell, not necessarily VBA code. Rick Rothstein gave me some good help and I was hoping to have him respond, but then a mod moved my discussion to an entirely new form.

Here's the table I had:


http://bob.woohoo.combob.woohoo.com
www.bob.woohoo.com/bob.woohoo.com
http://www.bill.woohoo.combill.woohoo.com
https://www.bill.woohoo.com/folder1bill.woohoo.com/folder1
http://bill.woohoo.com/folder1/bill.woohoo.com/folder1
http://www.bill.woohoo.com/folder1/folder2bill.woohoo.com/folder1/folder2
http://www.bill.woohoo.com/folder1/folder2/bill.woohoo.com/folder1/folder2
http://bill.woohoo.combill.woohoo.com
www.bill.woohoo.combill.woohoo.com
bill.woohoo.combill.woohoo.com
http://portal.hud.gov/hudportal/HUD/statesportal.hud.gov/hudportal/HUD/states
http://mapquest.com/mapquest.com
http://historymatters.gmu.edu/browse/refdesk/historymatters.gmu.edu/browse/refdesk
http://blast.ncbi.nlm.nih.gov/blast.ncbi.nlm.nih.gov
http://www.tfl.gov.uk/modalpages/2605.aspxtfl.gov.uk/modalpages/2605.aspx
http://www.constantcontact.com/features/tours.jspconstantcontact.com/features/tours.jsp


<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,972
Messages
6,128,035
Members
449,414
Latest member
sameri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top