Solved

How can I use Regex to parse the querystring

Posted on 2006-11-15
3
176 Views
Last Modified: 2010-04-16
I know that I can just use Request.QueryString("Page") to get the value "Home"
How can I use Regex to parse the querystring and get the Page Value.

string url = "http://67.59.187.45/events_view.aspx?EventID=322&Page=Home&Bla=Bla"

I want to use regex to parse the url string to get the result:
"Home"
0
Comment
Question by:quest_capital
3 Comments
 
LVL 15

Accepted Solution

by:
ozymandias earned 500 total points
ID: 17954393
string s = "http://67.59.187.45/events_view.aspx?EventID=322&Page=Home&Bla=Bla";
                  Regex r = new Regex("Page=([^&]*)");
                  Match m = r.Match(s);
                  Console.WriteLine(m.Groups[1].Value);
                  Console.ReadLine();
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now