' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.Collections.Specialized
Imports System.Web

Namespace E
    Public Class Program
        Public Shared Sub Test1(ByVal s As String)
            Console.WriteLine(s + " --> " + HttpUtility.ParseQueryString(s)("q"))
        End Sub
        Public Shared Sub Test2(ByVal s As String)
            Console.WriteLine(s + " --> " + HttpUtility.ParseQueryString((New Uri(s)).Query)("q"))
        End Sub
        Public Shared Sub Main(ByVal args As String())
            Test1("?hl=da&q=test&meta=")
            Test1("?q=test&Form=MSNH&cp=65001")
            Test1("http://www.google.dk/search?hl=da&q=test&meta=")
            Test1("http://search.msn.dk/results.aspx?q=test&Form=MSNH&cp=65001")
            Test2("http://www.google.dk/search?hl=da&q=test&meta=")
            Test2("http://search.msn.dk/results.aspx?q=test&Form=MSNH&cp=65001")
        End Sub
    End Class
End Namespace
