Regular expression question?

Tech-Archive recommends: Speed Up your PC by fixing your registry



My web application allow the user to enter the site by typing in a subdomain
such as 'name.domain.com'. However, I want to retrieve just the 'name' part
of the subdomain. see code below (the equal sign '=' respresent the value
I'm getting when I run the code)



Test 1.........................name.domain.com
Dim sdmlink As String = Request.Url.ToString

Dim sdm As Regex

sdm = New Regex("http://(?!www\.)(.*)(\.domain\.com.*)")

Context.Items("Test") = (sdm.Replace(sdmlink, "$1")) ---->> =
http://name.doman.com/welcome.aspx ---- this should = name



Test 2................name.domain.com
Dim sdmlink As String = Request.Url.ToString

Dim sdm As Regex

sdm = New Regex("http://(?!www\.)(.*)(\.domain\.com.*)")

Context.Items("Test") = (sdm.Replace(sdmlink,
"test/default.aspx?Id=$1")) ---->> = test/default.aspx?Id=name ---- this is
correct






.



Relevant Pages

  • Re: regular expression question?
    ... the user subdomain = tom.domain.com ... Dim subdomain As String = Request.Url.ToString ... Dim sdm As Regex ... >> Dim sdm As Regex ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Regular expression question?
    ... Dim sdmlink As String = Request.Url.ToString ... Dim sdm As Regex ...
    (microsoft.public.dotnet.framework.aspnet)
  • regular expression question?
    ... subdomain names 'leon.domain.com', but ... Dim sdm As Regex ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)
  • regular expression question?
    ... subdomain names 'leon.domain.com', but ... Dim sdm As Regex ... Prev by Date: ...
    (microsoft.public.dotnet.framework.aspnet)