Solved

How can I use Regex to parse the querystring

Posted on 2006-11-15
3
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

628 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