oh I see the problem, but don't know exactly how to fix it...see below
the follow code runs perfect when you pre include the url see... ---->>
http://name.domain.com/welcome.aspx
Dim sdmlink As String = "http://name.domain.com/welcome.aspx"
Dim sdm As New Regex("http://(?!www\.)(.*)(\.domain\.com.*)")
Response.Write("result : " & sdm.Replace(sdmlink, "$1")
' result : name
but what if you get the url in realtime request.url.tostring ---->
request.url.tostring
Dim sdmlink As String = request.url.tostring
Dim sdm As New Regex("http://(?!www\.)(.*)(\.domain\.com.*)")
Response.Write("result : " & sdm.Replace(sdmlink, "$1")
' result : the requested url
I added you to my msn cause I think your english isnt conversation quality
no offence :)
*Cool I don't see that you have added me. No offence taken :)
<to********************@pandora.be> wrote in message
news:a1**************************@news.microsoft.c om...
--->how do I extract just 'name' -not- 'test/default.aspx?Id=name'
Strange that you ask this because you yourself add it in the code :
Dim sdmlink As String = "http://name.domain.com/welcome.aspx"
Dim sdm As New Regex("http://(?!www\.)(.*)(\.domain\.com.*)")
Response.Write("result : " & sdm.Replace(sdmlink,
"test/default.aspx?Id=$1") & "<BR>")
' result : test/default.aspx?Id=name
your replace with : "test/default.aspx?Id=$1"
if you just want "name" do this :
Dim sdmlink As String = "http://name.domain.com/welcome.aspx"
Dim sdm As New Regex("http://(?!www\.)(.*)(\.domain\.com.*)")
Response.Write("result : " & sdm.Replace(sdmlink, "$1") & "<BR>") ' '
result : name
But we already posted this.
I cleaner way to get the "name" is like this :
Dim sdmlink As String = "http://name.domain.com/welcome.aspx"
Dim sdm As New Regex("http://(?!www\.)(.*)(\.domain\.com.*)")
Response.Write(sdm.Match(sdmlink).Groups(1))
' result : name
This produces only "name"
I added you to my msn cause I think your english isnt conversation quality
(no offence :)
If you still can't continue lets have a chat.