1

I would like to get the cid value of the url, in this case:

"http://www.google.com/products/catalog?hl=en&q=Dee+Zee+8170LB&um=1&ie=UTF-8&tbm=shop&cid=14199285063072465458"

Can I use regex for this or there is some better way to do it, except the old IndexOf string trimming.

1
  • 1
    @Guvante... can you be sure that your edit represents the user's requirements? Changing & to & is a gamechanger as far as the correct answer goes. I think this needs referring back to the OP. Commented May 31, 2012 at 0:04

1 Answer 1

4

You can try using HttpUtility.ParseQueryString.

Sign up to request clarification or add additional context in comments.

2 Comments

If we look at the original poster's unedited question, this solution won't work without first de-urlencoding the supplied string. The edit made to the question obscures this.
+1 ...and as a 1-liner: HttpUtility.ParseQueryString("http://www.google.com/products/catalog?hl=en&q=Dee+Zee+8170LB&um=1&ie=UTF-8&tbm=shop&cid=14199285063072465458")["cid"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.