RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Strip Domain from URL
Expression
http://[^/]*/
Description
I was looking for a long time for a simple regex to strip the domain name from a long url or to Get rid of directories and pages. I found a simple one that I wanted to share. If you have http://www.google.com/products/bob?gmail.ckj it will return only http://www.google.com getting rid of all the other parts of the url
Matches
http://www.google.com
Non-Matches
http://www.google.com/products/bob?gmail.ckj
Author Rating: Not yet rated. Adil Berdai
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials