Since VB.NET is in the tag for this question, I assume you have access at the server side to the Request object:
Dim instance As HttpRequest
Dim value As String
value = instance.Path
This should give you exactly what you asked for.
Edit: On second thought - you could be parsing URLs from some input string... in which case, regex will only help if you have a simple (regular) set of inputs:
Do you know all the possible domains? i.e. are "http://www.ABC.com" and "http://www.DEF.com" the only possible domains?
Then here:
Dim text As String = "http://www.ABC.com/folder1/folder2/file.txt"
Dim pattern As String = "(?:http://www.ABC.com|http://www.DEF.com)(.*)"
Dim r As Regex = new Regex(pattern, RegexOptions.IgnoreCase)
' Match the regular expression pattern against a text string.
Dim m As Match = r.Match(text)
Dim g as Group = m.Groups(2) 'Gives the string matched by the capturing parentheses