Solved

How can I use Regex to parse the querystring

Posted on 2006-11-15
3
180 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

734 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