Developers Heaven Forum
News: To still receiving newsletters from us please subscribe to our Newsletters:
http://tech.groups.yahoo.com/group/developers-Heaven/
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 12, 2010, 06:46:40 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: C# Regular Expression to Removing Subdomains from a URL  (Read 129 times)
0 Members and 1 Guest are viewing this topic.
admin
Administrator
Full Member
*****
Offline Offline

Posts: 206


OS:
unknown
Browser:
unknown


View Profile
« on: August 28, 2008, 09:27:47 AM »

Hello all,
if you need regular expression to remove all the subdomains from a url to leave only the domain name. e.g.

http://rss.abc.def.SiteName.com.edu.au

<after applying regex leave>

SiteName.com.edu.au

Then you can use the following:

Code:
Regex.Replace( mySiteUrl, ".*SiteName", "SiteName", RegexOptions.IgnoreCase );


Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Google
   
Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC

Copyright © Developers-Heaven.net 2008. All rights reserved.
Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM