DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In
sgray128 8/17/2014 10:15:12 PM

Regex - match part of a URL querystring

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

I struggle mightily with Regex, so every time that I achieve something I blog it.

Today, I wanted to look into the URL of a web site and remove part of the query string. Specifically, in these cases:

www.mysite.com?userid=123xy

www.mysite.com?userid=123xy&username=joe

www.mysite.com?tag=xyz&userid=1ww45

www.mysite.com?tag=xyz&userid=1g3x5&username=joe

I wanted to remove the 'userid=xxxxx' out of the url.

Version: Unknown or N/A
Section: .NET Development